.bat
Mistgun121221
-
barnabe0057 Messages postés 14329 Date d'inscription Statut Contributeur Dernière intervention -
barnabe0057 Messages postés 14329 Date d'inscription Statut Contributeur Dernière intervention -
Bonjour, j'aimerais créer un fichier .bat qui ouvre cmd et me demande mon nom. Et j'aimerais que si le nom entrer n est pas le mien que mon pc s'éteigne. Pour l'instant j ai ceci:
@Echo OFF
SET nom=
SET /p nom=Votre nom:
echo bonjour %nom%
if nom=Alexandre
exit
if nom=
shutdown /s /t "5" /c "cheh"
pause
pouvez vous m'aider?
@Echo OFF
SET nom=
SET /p nom=Votre nom:
echo bonjour %nom%
if nom=Alexandre
exit
if nom=
shutdown /s /t "5" /c "cheh"
pause
pouvez vous m'aider?
Configuration: Windows / Chrome 85.0.4183.102
1 réponse
-
Bonjour,
Essaie comme ceci :
@Echo OFF
:debut
set "nom="
set /p nom="Votre nom: "
if not defined nom (goto :debut)
echo bonjour %nom%
if not "%nom%"=="Alexandre" (shutdown /s /t "5" /c "cheh")
pause