Bat file

Status
Niet open voor verdere reacties.

MoonLight

Gebruiker
Lid geworden
25 sep 2006
Berichten
30
Ik heb een probleem, ik ben in bat een menu aan het maken. Alleen werkt niet
Kan iemand mij hierbij helpen?

Code:
@ECHO OFF


ECHO.
ECHO    Turn on Net? Press: `1'
ECHO.
ECHO    To Disable,  Press: `2' 
ECHO.

CHOICE /C:R<- /N > NUL
IF ERRORLEVEL 2 GOTO END
IF ERRORLEVEL 1 GOTO REBOOT
GOTO END


:REBOOT
net stop client32

:END
net start client32
 
Hierbij een voorbeeldje dat wel werkt:

@ECHO OFF
REM - LABEL INDICATING THE BEGINNING OF THE DOCUMENT.
:BEGIN
CLS
REM - THE BELOW LINE GIVES THE USER 3 CHOICES (DEFINED AFTER /C:)
CHOICE /N /C:123 PICK A NUMBER (1, 2, or 3)%1
REM - THE NEXT THREE LINES ARE DIRECTING USER DEPENDING UPON INPUT
IF ERRORLEVEL ==3 GOTO THREE
IF ERRORLEVEL ==2 GOTO TWO
IF ERRORLEVEL ==1 GOTO ONE
GOTO END
:THREE
ECHO YOU HAVE PRESSED THREE
GOTO END
:TWO
ECHO YOU HAVE PRESSED TWO
GOTO END
:ONE
ECHO YOU HAVE PRESSED ONE
:END



Meer informatie over DOS batchfiles kun je hier vinden: http://www.computerhope.com/batch.htm#03
 
Hoi MoonLight,

Werkt dit dan misschien?

Code:
@ECHO off
cls
:start
ECHO.
ECHO.
ECHO    Turn on Net? Press: `1'
ECHO.
ECHO    To Disable,  Press: `2' 
ECHO.
set choice=
set /p choice=Type the number to print text.
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto START
if '%choice%'=='2' goto REBOOT
ECHO "%choice%" is not valid please try again
ECHO.
goto start

:REBOOT
net stop client32
goto end

:START
net start client32
goto end

:end

Bron:http://www.computerhope.com/sethlp.htm

suc6
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan