| 1. |
Solve : goto help...? |
|
Answer» I am TRYING to make a batch file with a menu, but it doesn't work. No matter what i push it just goes onto the next line or just exits: And the next homework assignment will beThey'll never end...incidentally, if you are checking for errorlevel, you need to arrange the test in reverse order, with the highest errorlevel tested for at the TOP, and errorlevel 1 at the bottom of the list, because "if errorlevel 1" means "if errorlevel is equal to or greater than 1" and if you have it at the top, any nonzero errorlevel will trigger it and the rest will be skipped. Right about the order of the "If errorlevel" commands. Nobody mentioned the way you want to set your errorlevel. Set it with the choice command. But wait Microsoft dropped the choice command in recent versions.(I don't know why. It seems that they would have kept it for backward compatibility, even if there are better ways to do the same thing.)(yes I read on this forum that there is a choice written by someone else that you can use, but that is extra baggage.) By the way Dark Blade, Thanks for the set /p var=... method you posted. I have been away from writing batch files for a few years and was not familiar. I will be trying this as it is close to something I'm trying to do. Quote from: llmeyer1000 on February 20, 2008, 08:50:02 AM ... Explore here: http://hp.vector.co.jp/authors/VA007219/dkclonesup/choice.html to download various versions of choice . Quote (I don't know why. It seems that they would have kept it for backward compatibility, even if there are better ways to do the same thing.)(yes I read on this forum that there is a choice written by someone else that you can use, but that is extra baggage.) No moreso than any other external command. Just put a copy of it in a directory that is in your path, same as MS would have done if they had included it in the first place. Thanks Dark! i had just been looking at the set /p command before i came back to this forum but didn't know exactly how to use it. And for those that think this is a homework assignment its not!!! I was just making a batch file for fun. |
|