
Ich versuche, einen Ordner mit einer Batchdatei zu verbergen, indem ich den Befehl attrib verwende, und ich möchte die Datei mit derselben Batchdatei auch wieder sichtbar machen. Kann ich dies als einzelne Batchdatei tun? Oder muss ich eine andere aufrufen und welche Befehle muss ich verwenden, um dies zu ermöglichen? Danke
Bisher habe ich
attrib +h +s Foldername
Und
attrib -h -s Foldername
Aber das funktioniert nicht, denn sobald ich es sichtbar mache, wird es wieder ausgeblendet.
Antwort1
@echo off
Set /P Answer=Do you wish to hide File (Y/N)?
if /I {%ANSWER%}=={y} (goto :yes)
if /I {%ANSWER%}=={Y} (goto :yes)
if /I {%ANSWER%}=={n} (goto :no)
if /I {%ANSWER%}=={N} (goto :no)
:yes
attrib +h Foldername
pause
exit
:no
attrib -h Foldername
pause
exit
Diese Batchdatei sorgt dafür, dass die Datei ausgeblendet wird, wenn Sie „J“ für „Ja“ wählen, und sichtbar wird, wenn Sie „N“ für „Nein“ wählen. Original-Batchdatei.
Antwort2
Ich habe es folgendermaßen versucht: -
attrib +h +s tempFolder
pause
attrib -h -s tempFolder
pause
Mit dieser Batchdatei kann ich sehen, dass der Ordner entsprechend ausgeblendet und angezeigt wird.
Antwort3
So etwas sollte funktionieren:
Set _Path=C:\foldername
For /F "Delims=" %%I In ('Attrib "%_Path%"') Do Set _Attribs=%%I
If "%_Attribs:~4,1%"=="H" (
Attrib -S -H "%_Path%"
Attrib /D /S -S -H "%_Path%"\*.*
) Else (
Attrib +S +H "%_Path%"
Attrib /D /S +S +H "%_Path%"\*.*
)
Habe das von techguys.org
Antwort4
cls
/@echo off
/title Folder Locker
/IF EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" GOTO UNLOCK
/IF NOT EXIST Locker GOTO MDLOCKER
/echo Folder Created.
/: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 Locker "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
/attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
/echo Folder Locked.
/GOTO END
/:UNLOCK
/echo Enter password to unlock the Folder :
/set/p "pass="
/IF NOT %pass% == YourPassword GOTO FAIL
/attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
/ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" LOCK
/echo Folder Unlocked Successfully.
/GOTO END
/:FAIL
/echo Invalid Password!
/GOTO END
/:MDLOCKER
/md Locker
/echo Folder created.
/GOTO END
/:END
/PAUSE
!!!!!WICHTIG!!!!
WO ES HEISST: WENN NICHT %pass% == IhrPasswort, GEHEN SIE ZU FEHLER, ÄNDERN SIE IHRPASSWORT IN DAS VON IHNEN GEWÜNSCHTE PASSWORT. Wo ich den "/" gesetzt habe, bedeutet das Drücken der Eingabetaste