Besoin d'aide pour prog batch

Fermé
Weedbill - 6 juin 2010 à 20:37
karirovax Messages postés 3221 Date d'inscription dimanche 17 janvier 2010 Statut Membre Dernière intervention 22 juin 2016 - 8 juin 2010 à 21:21
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



A voir également:

1 réponse

dubcek Messages postés 18718 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 22 mars 2024 5 615
7 juin 2010 à 09:20
hello
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%
1
karirovax Messages postés 3221 Date d'inscription dimanche 17 janvier 2010 Statut Membre Dernière intervention 22 juin 2016 203
8 juin 2010 à 21:21
salut

oui dubcek c éxactement ceci ;)
j'ai voté pour vous
0