Hi
I am new to this. I am looking for a code which can help me put password to selective folders in my c drive. further, it should also provide me an option to unlock it when i need it.
Actually, there are various file types in multiple folders ( .xls, .doc, .ppt, .txt etc) which we keep using multiple times during the day but would have to put a password on them when they are not in use. locking unlocking becomes very tedious.
Was hoping that if i am able to put a password in all those folders, i would avoid putting passwords to each an every file. The issue is, that I need to access these folders ( 25-30 folders) multiple times a day and blocking unblocking them manually is very time consuming.
is there a command which i can auto execute to lock and unlock ?
Cannot use any software to achieve it and I do not have admin access to the system.
Thanks
password protection
Moderator: DosItHelp
Re: password protection
npsays wrote:Cannot use any software to achieve it and I do not have admin access to the system.
is there a command which i can auto execute to lock and unlock ?
Given those limitations, I doubt it.
You can encrypt the volume so it needs a password to access it when you boot and mount the volume but probably not without admin access and in simpler versions of windows you will need the volume encryption software.
Re: password protection
'
This is an example of a weak locking mechanism that makes a folders contents inaccessible.
'tstfolderLocker.CMD'
'folderLocker.CMD'
No there isn't, how do you unlock a folder manuallynpsays wrote:I need to access these folders ( 25-30 folders) multiple times a day and blocking unblocking them manually is very time consuming.
is there a command which i can auto execute to lock and unlock ?
This is an example of a weak locking mechanism that makes a folders contents inaccessible.
'tstfolderLocker.CMD'
Code: Select all
@echo off &setlocal enableDelayedExpansion
echo.
echo. a weak locking mechanism that makes a folders contents inaccessible.
echo. WARNING (
echo.
echo. this will NOT hide any folder !
echo. this will NOT prevent a folder to be deleted !
echo. )
md "test"
call "folderLocker.CMD" /lock: "test"
call "folderLocker.CMD" /unlock: "test"
rd /q "test"
echo. &pause &exit
Code: Select all
@echo off &setlocal enableDelayedExpansion
set "$error.0=ok"
set "$error.1=error"
set /a $err = 1 &if /i "%~1" == "/lock:" (
if exist "%~2\" (
ren "%~2" "%~2.{645FF040-5081-101B-9F08-00AA002F954E}"
set /a $err = 0
)
) else if /i "%~1" == "/unLock:" (
if exist "%~2.{645FF040-5081-101B-9F08-00AA002F954E}\" (
ren "%~2.{645FF040-5081-101B-9F08-00AA002F954E}" "%~2"
set /a $err = 0
)
)
echo. &<nul set /p "=%~0 %~1 '%~2' [!$error.%$err%!:!$err!]" &>nul 2>&1 ping 0.0.0.0
endlocal &exit /b %$err%
Re: password protection
Hi Ed,
Thanks for the code. Even if the command makes folder contents inaccesible it will serve the purpose.
To try this code i did the following:
- I saved the code in a txt file and renamed it to ext CMD ( as captioned in your code)
- saved the file in c drive and double clicked it.
Result:
- I was able to get a folder created (test) in C drive but I could access it.
- got a message as: " folderlocker.cmd" is not recognised as internal or external command, operable program or batch file. The directory is not empty.
Please let me know if I am doing it incorrectly.
Secondly, I already have predefined folders, so I don't need to create them. Is there a way in which I can list those folders which are supposed to be inaccesible / accesible again.
Thanks for your response.
Thanks for the code. Even if the command makes folder contents inaccesible it will serve the purpose.
To try this code i did the following:
- I saved the code in a txt file and renamed it to ext CMD ( as captioned in your code)
- saved the file in c drive and double clicked it.
Result:
- I was able to get a folder created (test) in C drive but I could access it.
- got a message as: " folderlocker.cmd" is not recognised as internal or external command, operable program or batch file. The directory is not empty.
Please let me know if I am doing it incorrectly.
Secondly, I already have predefined folders, so I don't need to create them. Is there a way in which I can list those folders which are supposed to be inaccesible / accesible again.
Thanks for your response.
Re: password protection
Secondly, I already have predefined folders, so I don't need to create them. Is there a way in which I can list those folders which are supposed to be inaccesible / accesible again.
before:
at:
A simple script
Code: Select all
@echo off
::
if exist FolderList goto :show
::
:hide
for /f "delims=" %%? in ('dir /a:d /b') do (
echo %%?>>FolderList
ren "%%?" "%%?.{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
attrib +h +s "%%?.{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
)
attrib +h +s "FolderList"
exit
:show
for /f "delims=" %%? in (FolderList) do (
attrib -h -s "%%?.{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
ren "%%?.{20D04FE0-3AEA-1069-A2D8-08002B30309D}" "%%?"
)
del /a:h,s FolderList
exit
The choice of a password
Code: Select all
@echo off
::
if exist FolderList goto :show
::
:hide
for /f "delims=" %%? in ('dir /a:d /b') do (
echo %%?>>FolderList
ren "%%?" "%%?.{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
attrib +h +s "%%?.{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
)
attrib +h +s "FolderList"
exit
:show
cls
set /p P=Enter your password^>
if /i "%P%"=="1234" ( rem rem <- here to change your password
for /f "delims=" %%? in (FolderList) do (
attrib -h -s "%%?.{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
ren "%%?.{20D04FE0-3AEA-1069-A2D8-08002B30309D}" "%%?"
)
del /a:h,s FolderList
exit
) else (
echo Wrong password!
pause>nul
goto :show
)
)
Once the password in the script to compile it to exe
Code: Select all
Advanced BAT to EXE Converter
http://www.battoexeconverter.com
Re: password protection
This one should do the trick ! Thanks a lot. i'll try it and let you know incase of any issues faced. Thanks Again!!!!