| ||||||||
Petite astucienne | Bonjour Astuciennes et Astuciens.
J'ai trouvé ce code batch pour masquer un dossier (voir ce lien: http://pc-hacks.blogspot.com/2007/10/lock-folders-without-any-software.html) Problème 1: Le dossier caché ne réapparaît pas cls @echo off color 9f title Folder Locker :option echo 1.Create folder 2.Lock folder 3.Unlock folder 4.Set password set/p "option=Please choose option 1-4>" if %option%==1 goto create if %option%==2 goto lock if %option%==3 goto unlock if %option%==4 goto set echo Invalid choice goto option :create if exist "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" (echo You already have a locked folder & goto option) if not exist "Locker" (md Locker & echo Locker created successfully ) Else (echo Locker folder already exist) if defined mypass (goto option) echo This is the first time you run this program please enter a echo password and log off this user and logon again for the echo password to take effect. set /p "long=Set your password>" reg add "hklm\system\currentcontrolset\control\session manager\environment" /v mypass /d %long% /f cls echo Password set successfully goto option :lock if exist "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" (echo Folder already locked & goto option) if not exist "Locker" (echo You need to create a folder first & goto Option) ren Locker "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" echo Folder Locked Successfully goto option :unlock set x=1 set /a y=y + x if %y% GTR 3 goto wait if exist "Locker" (echo No file to unlock & goto option) if not exist "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" (echo No file to unlock & goto option) if not defined mypass (echo You need to set a password & goto option) set/p "pass=Enter password to unlock folder>" if not %pass%==%mypass% (echo Invalid password & goto unlock) attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Locker echo Folder unlocked successfully goto option :set echo 1.Change password 2.Remove password set /p "short=Please choose option 1-2>" if %short%==1 goto reset if %short%==2 goto remove :reset echo You have select to change your password if you do not wish echo to continue please close the command prompt else enter the echo old password to continue. set /p "longer=Enter old password>" if not %longer%==%mypass% (echo Invalid password & goto set) set /p "longest=Enter new password>" reg add "hklm\system\currentcontrolset\control\session manager\environment" /v mypass /d %longest% /f cls echo Please log off and login again for password to take effect goto option :remove if exist "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" (echo Please unlock folder before proceed to remove password & goto option) echo You have select to remove your password if you do not wish echo to continue please close the command prompt else enter the echo old password. set /p "longer=Enter old password>" if not %longer%==%mypass% (echo Invalid password & goto remove) reg delete "hklm\system\currentcontrolset\control\session manager\environment" /v mypass /f cls echo Password remove successfully echo Please log off and login again for password to fully erased from memory goto option :wait cls echo You have enter an invalid password 3 times in a row please echo try again. goto option
Si les lignes en gras sont effacées, le dossier caché réapparaît
cls @echo off color 9f title Folder Locker :option echo 1.Create folder 2.Lock folder 3.Unlock folder 4.Set password set/p "option=Please choose option 1-4>" if %option%==1 goto create if %option%==2 goto lock if %option%==3 goto unlock if %option%==4 goto set echo Invalid choice goto option :create if exist "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" (echo You already have a locked folder & goto option) if not exist "Locker" (md Locker & echo Locker created successfully ) Else (echo Locker folder already exist) if defined mypass (goto option) echo This is the first time you run this program please enter a echo password and log off this user and logon again for the echo password to take effect. set /p "long=Set your password>" reg add "hklm\system\currentcontrolset\control\session manager\environment" /v mypass /d %long% /f cls echo Password set successfully goto option :lock if exist "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" (echo Folder already locked & goto option) if not exist "Locker" (echo You need to create a folder first & goto Option) ren Locker "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" echo Folder Locked Successfully goto option :unlock set x=1 set /a y=y + x if %y% GTR 3 goto wait if exist "Locker" (echo No file to unlock & goto option) if not exist "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" (echo No file to unlock & goto option) if not defined mypass (echo You need to set a password & goto option) set/p "pass=Enter password to unlock folder>" if not %pass%==%mypass% (echo Invalid password & goto unlock) attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Locker echo Folder unlocked successfully goto option :set echo 1.Change password 2.Remove password set /p "short=Please choose option 1-2>" if %short%==1 goto reset if %short%==2 goto remove :reset echo You have select to change your password if you do not wish echo to continue please close the command prompt else enter the echo old password to continue. set /p "longer=Enter old password>" if not %longer%==%mypass% (echo Invalid password & goto set) set /p "longest=Enter new password>" reg add "hklm\system\currentcontrolset\control\session manager\environment" /v mypass /d %longest% /f cls echo Please log off and login again for password to take effect goto option :remove if exist "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" (echo Please unlock folder before proceed to remove password & goto option) echo You have select to remove your password if you do not wish echo to continue please close the command prompt else enter the echo old password. set /p "longer=Enter old password>" if not %longer%==%mypass% (echo Invalid password & goto remove) reg delete "hklm\system\currentcontrolset\control\session manager\environment" /v mypass /f cls echo Password remove successfully echo Please log off and login again for password to fully erased from memory goto option :wait cls echo You have enter an invalid password 3 times in a row please echo try again. goto option
Problème 2: Dans le menu du batch, on peut changer ou supprimer le mot de passe (voir l'option 4) Or cette option ne fonctionne pas Peut-on corriger ces 2 problèmes ? Merci de bien vouloir m'aider. | |||||||
Publicité | ||||||||
|
Les bons plans du moment PC Astuces | Tous les Bons Plans | |||||||||||||||
|