Besoin d'aide pour prog batch
Weedbill
-
karirovax Messages postés 3221 Date d'inscription Statut Membre Dernière intervention -
karirovax Messages postés 3221 Date d'inscription Statut Membre Dernière intervention -
Bonjour, la communauté, j'ai besoin d'aide je m'explique, je souhaite faire un petit batch pour pouvoir programmer l'arret de mon ordinateur, je trouve pas mon erreur, je vous poste ce que j'ai fais :
@echo off
echo Dans combiens d'heures voulez-vous eteindre votre ordinateur?
CHOICE /C:123456789
IF ERRORLEVEL ==1 GOTO CHOIX1
IF ERRORLEVEL ==2 GOTO CHOIX2
IF ERRORLEVEL ==3 GOTO CHOIX3
IF ERRORLEVEL ==4 GOTO CHOIX4
IF ERRORLEVEL ==5 GOTO CHOIX5
IF ERRORLEVEL ==6 GOTO CHOIX6
IF ERRORLEVEL ==7 GOTO CHOIX7
IF ERRORLEVEL ==8 GOTO CHOIX8
IF ERRORLEVEL ==9 GOTO CHOIX9
GOTO END
:CHOIX1
ECHO Vous avez choisi d'eteindre votre ordinateur dans 1h
SHUTDOWN -s -T 3600
GOTO END
:CHOIX2
ECHO Vous avez choisi d'eteindre votre ordinateur dans 2h
SHUTDOWN -s -T 7200
GOTO END
:CHOIX3
ECHO Vous avez choisi d'eteindre votre ordinateur dans 3h
SHUTDOWN -s -T 10800
GOTO END
:CHOIX4
ECHO Vous avez choisi d'eteindre votre ordinateur dans 4h
SHUTDOWN -s -T 14400
GOTO END
:CHOIX5
ECHO Vous avez choisi d'eteindre votre ordinateur dans 5h
SHUTDOWN -s -T 18000
GOTO END
:CHOIX6
ECHO Vous avez choisi d'eteindre votre ordinateur dans 6h
SHUTDOWN -s -T 21600
GOTO END
:CHOIX7
ECHO Vous avez choisi d'eteindre votre ordinateur dans 7h
SHUTDOWN -s -T 25200
GOTO END
:CHOIX8
ECHO Vous avez choisi d'eteindre votre ordinateur dans 8h
SHUTDOWN -s -T 28800
GOTO END
:CHOIX9
ECHO Vous avez choisi d'eteindre votre ordinateur dans 9h
SHUTDOWN -s -T 32400
GOTO END
:END
pause
Ou est l'erreur svp =) merci d'avance
@echo off
echo Dans combiens d'heures voulez-vous eteindre votre ordinateur?
CHOICE /C:123456789
IF ERRORLEVEL ==1 GOTO CHOIX1
IF ERRORLEVEL ==2 GOTO CHOIX2
IF ERRORLEVEL ==3 GOTO CHOIX3
IF ERRORLEVEL ==4 GOTO CHOIX4
IF ERRORLEVEL ==5 GOTO CHOIX5
IF ERRORLEVEL ==6 GOTO CHOIX6
IF ERRORLEVEL ==7 GOTO CHOIX7
IF ERRORLEVEL ==8 GOTO CHOIX8
IF ERRORLEVEL ==9 GOTO CHOIX9
GOTO END
:CHOIX1
ECHO Vous avez choisi d'eteindre votre ordinateur dans 1h
SHUTDOWN -s -T 3600
GOTO END
:CHOIX2
ECHO Vous avez choisi d'eteindre votre ordinateur dans 2h
SHUTDOWN -s -T 7200
GOTO END
:CHOIX3
ECHO Vous avez choisi d'eteindre votre ordinateur dans 3h
SHUTDOWN -s -T 10800
GOTO END
:CHOIX4
ECHO Vous avez choisi d'eteindre votre ordinateur dans 4h
SHUTDOWN -s -T 14400
GOTO END
:CHOIX5
ECHO Vous avez choisi d'eteindre votre ordinateur dans 5h
SHUTDOWN -s -T 18000
GOTO END
:CHOIX6
ECHO Vous avez choisi d'eteindre votre ordinateur dans 6h
SHUTDOWN -s -T 21600
GOTO END
:CHOIX7
ECHO Vous avez choisi d'eteindre votre ordinateur dans 7h
SHUTDOWN -s -T 25200
GOTO END
:CHOIX8
ECHO Vous avez choisi d'eteindre votre ordinateur dans 8h
SHUTDOWN -s -T 28800
GOTO END
:CHOIX9
ECHO Vous avez choisi d'eteindre votre ordinateur dans 9h
SHUTDOWN -s -T 32400
GOTO END
:END
pause
Ou est l'erreur svp =) merci d'avance
A voir également:
- Besoin d'aide pour prog batch
- Fichier batch - Guide
- Robot prog - Télécharger - Édition & Programmation
- Batch converter - Télécharger - Photo & Graphisme
- Batch renommer une partie du nom de plusieurs fichiers ✓ - Forum Autoit / batch
- Color batch - Forum Autoit / batch
1 réponse
hello
essayer
ou simplifier
essayer
IF ERRORLEVEL 1 GOTO CHOIX1 ... ou IF %errorlevel% EQU 1 GOTO CHOIX1 ...
ou simplifier
@echo off echo Dans combiens d'heures voulez-vous eteindre votre ordinateur? CHOICE /C:123456789 set heure=%errorlevel% set /a secs=3600*%heure% ECHO Vous avez choisi d'eteindre votre ordinateur dans %heure%h SHUTDOWN -s -T %secs%
oui dubcek c éxactement ceci ;)
j'ai voté pour vous