DOS commands not behaving

470 pts.
Tags:
64-bit Windows 7
MS-DOS
Windows desktop
This is an easy question for most of you tech geniuses, but it is just driving me crazy. User asked me to create a password protected folder on a share drive. The option of getting and installing a 3rd party software for this task was nixed by higher powers. I researched the web and found an easy Dos script saved as .bat file and commonly suggested as a work around. Of course, this bat file basically hides the folder and any reasonably informed user could find it anyway. But what I noticed is that script is "ignoring" command line to turn the folder into hidden system folder (+h +s). Here is the script:
cls
@ECHO OFF
title Folder Private
if EXIST "HTG Locker" goto UNLOCK
if NOT EXIST Private goto MDLOCKER
:CONFIRM
echo Are you sure you want to lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Private "HTG Locker"
attrib +h +s "HTG Locker"
echo Folder locked
goto End


:UNLOCK
echo Enter password to unlock folder
set/p "pass=>"
if NOT %pass%== malimedo goto FAIL
attrib -h -s "HTG Locker"
ren "HTG Locker" Private
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Private
echo Private created successfully
goto End
:End
So, what happens is that when you answer "y" to whether you want to lock the folder, the Private folder is renamed to HTG Locker and HTG Locker shows up, even though it is supposed to be hidden. This renders already clumsy "solution" totally useless as HTG Locker is visible and is basically your hidden folder with all the "secret stuff".  I made sure that "folder options" options are all checked properly.  I read comments from users on the web and some of them had the same problem but there were no suggestion as to why is this happening. So I am puzzled by the attrib command line which seems to be ignored. I am far from DOS expert, but I am familiar with programming... Thank you for any advice you may offer. Sincerely, Mickey

Software/Hardware used:
Windows 7

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    Does it happen regardless of the operating system being used?

    When this happens, do you see the "Folder locked" text that should be displayed?

    68,710 pointsBadges:
    report
  • mikidc

    Carlos, thank you for trying to help me.

    I only tested on Win7 platform since thats all we have here where my users are. I am not an admin person but first response type of tech support.

    When I click on locker bat file and anser "y" the message shows up tooo fast, so I inserted Pause command and yes after answering "y" the following text shows up:

    Access is denied.

    Folder locked

    Press any key to continue...

    Mickey

     

     

    470 pointsBadges:
    report
  • carlosdl
    Hi Mickey.

    It is most likely a permissions issue.  The user should have the "write attributes" (and/or maybe write extended attributes) permission on the "Private" folder.  Those are "special" permissions.
    68,710 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following