|
Answer» Well, i lost the technique after some month's of gaming.
I tryed to do this:
@echo off title Test menu color F0 :Menu echo Test menu. echo -------------- echo 1. echo weeeeeeeeeeeeeeeeee it works echo 2. quit set /p input=Input: if 'input' == '1' goto wee if 'input' == '2' exit :wee echo weeeeeeeeeeeeeeeeee it works pause quit
I didnt work, it just skipped everything and said wee paused and quitted.
What did i do wrong?if /i %input%==1 goto :weeI would change Carbon's code slightly. You don't really need the /i because we are only comparing NUMBERS. I would also add brackets (or quotes) to the comparisons, otherwise, if the user just presses [Enter] the variable would be BLANK and the batch file would probably exit with an error. Code: [Select]if {%input%}=={1} goto :weeAlso, I don't THINK QUIT is not an internal command or standard external command. I would probably change that to Code: [Select]goto :EOFIf you want the batch file to close, it does that automatically at the end of the script. Otherwise, the correct command is exitactually, the GOTO :EOF is better- if they start the batch from the command-line, then the exit command will close that command interpreter instance on them. whereas the goto will go to the end of the file and the command interpreter will be returned control.Ok thanks Trying to see if it works. Man sorry for gravedigging. I just WENT on some skiing trip.
|