Global $title = "Coffre fort avec un mot de passe"
If FileExists(@ScriptDir & "\Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}") Then ouvre()
If Not FileExists(@ScriptDir & "\Coffre") Then coffre()
confirm()
Func confirm()
$mMsgbox = MsgBox(4, $title, "Voulez-vous vérouiller le dossier Coffre ?")
If $mMsgbox = 6 Then
ferme()
ElseIf $mMsgbox = 7 Then
fin()
Else
confirm()
EndIf
EndFunc ;==>confirm
Func ferme()
DirMove(@ScriptDir & "\Coffre", @ScriptDir & "\Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}")
FileSetAttrib(@ScriptDir & "\Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}", "+HS")
MsgBox(0, $title, "Le dossier Coffre a été vérouillé")
fin()
EndFunc ;==>ferme
Func ouvre()
$vMdP = InputBox($title, "Mot de passe pour ouvrir le coffre", "", "|")
If Not $vMdP = "pass" Then niet()
FileSetAttrib(@ScriptDir & "\Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}", "-HS")
DirMove(@ScriptDir & "\Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}", "Coffre")
MsgBox(0, $title, "Le dossier Coffre est ouvert")
fin()
EndFunc ;==>ouvre
Func niet()
MsgBox(0, $title, "Mot de passe incorrect")
fin()
EndFunc ;==>niet
Func coffre()
DirCreate("Coffre")
MsgBox(0, $title, "Le dossier Coffre est crée")
fin()
EndFunc ;==>coffre
Func fin()
Exit
EndFunc ;==>fin
Tésté et approuvé.
Le "je ne sais pas" et "j'y arrive pas" n'existe dans mon vocabulaire. Toutes Questions ont une réponse, cherchez et vous la trouverai. Utilisez Recherche du forum et vous verrez. Si [blink]Aucune[/blink] question ne tient à votre problème, créez un sujet.
@echo off
title Coffre-fort
echo.
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" (goto ouvre)
if NOT EXIST "Coffre-fort" (goto coffre)
:CONFIRM
cls
echo.
echo Voulez vous v‚rouiller le coffre-fort ?(O/N)
set/p cho=
if /i "%cho%"=="O" (goto ferme)
if /i "%cho%"=="N" (exit)
echo Choix incorrect ! Veuillez r‚‚ssayer.
goto CONFIRM
:ferme
cls
echo.
ren "Coffre-fort" "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Le coffre-fort a ‚t‚ v‚rouill‚.
goto fin
:ouvre
cls
echo.
echo Entrez le mot de passe :
set /p "pass=Mot de passe : "
set mdp=0
call "D:\Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}\mdp.bat"
if NOT "%pass%"=="%mdp%" (goto niet)
set mdp=0
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" "Coffre-fort"
cls
echo.
echo Le coffre-fort a ‚t‚ d‚v‚rouill‚.
goto fin
:niet
cls
echo.
echo Mot de passe incorrect !!!
goto fin
:coffre
cls
echo.
md Coffre-fort
echo Le coffre-fort a ‚t‚ cr‚‚.
set increm=0
goto increm
:increm
set /a increm=%increm% + 1
if "%increm%"=="300" (goto suite) else (goto increm)
:suite
cls
echo.
echo Entrez le nouveau mot de passe :
set /p "MotDePasse=Mot de passe : "
echo set mdp=%MotDePasse%>>".\Coffre-fort\mdp.bat"
attrib +h +s ".\Coffre-fort\mdp.bat"
cls
echo.
echo N'oubliez pas votre mot de passe : %MotDePasse%.
set incrementation=0
goto incrementation
:incrementation
set /a incrementation=%incrementation% + 1
if "%incrementation%"=="300" (goto confirm) else (goto incrementation)
:fin
set incr=0
goto incr
:incr
set /a incr=%incr% + 1
if "%incr%"=="500" (exit) else (goto incr)
Surtout ne créez aucun dossier. Enregistrez le logiciel où vous voulez (toujours sous "le nom.bat") puis lancez le.
Cette fois, le mot de passe n'est plus accessible en faisant clique-droit\"modifier".
Pour refaire le mode passe, il faut supprimer le dossier "Coffre" qui aura été créé et relancer le logiciel.
Bonjour,
j'ai essayé le script d'Alex1205.
en fait, si dans les options de dossier on choisit d'afficher les fichiers et dossiers masqués, on voit le coffre tout le temps et on peut y accéder.