| 1. |
Solve : if exit..? |
|
Answer» how do i make it so that if the ms-dos is exit that it will then start a file or a code?
You can't do this. (EXPAND a variable to a label name & goto it) ok...now try this Code: [Select]set /a var=%random%%%4 if %var% equ 0 set one=I like it cause of that to. if %var% equ 1 set one=eww, are you shurr? if %var% equ 2 set one=Wow, never thought of that. if %var% equ 3 set one=Are you shurr? echo %one% pause label %one% goto oneFrom testing, I discovered you can in fact expand a label name go to it: Code: [Select]set one=two if errorlevel 0 goto %one% goto :eof :two echo %one% If you leave echo on you can see the expansion in real time. You cannot however expand a variable as part of a label: Code: [Select]set one=two if errorlevel 0 goto %one% goto :eof :%one% echo %one% Quote from: macdad- on March 20, 2008, 11:59:59 AM label %one% What does this line do? PS Can we spell "sure" properly please? Quote from: Sidewinder on March 20, 2008, 12:49:11 PM From testing, I discovered you can in fact expand a label name go to it: So you can, I now see. I was always taught that self-modifying code is a bad idea, however. Quote You cannot however expand a variable as part of a label: I think that was what I was thinking of. Quote So you can, I now see. I was always taught that self-modifying code is a bad idea, however. Amen Debugging such a beast can be a nightmare. Just because you can do something is no reason.... I'm still trying to figure out what the OP meant by if the ms-dos is exit And somebody else needs to look up the label command... Quote the word 'sure' is spelt thus. Thus SPAKE Zarathrustra Quote from: Aegis on March 20, 2008, 02:48:16 PM Quotethe word 'sure' is spelt thus. Thus Spoke Z a r a t h u s t r a (German: Also sprach Zarathustra, sometimes translated Thus Spake Zarathustra), subtitled A Book for All and None (Ein Buch für Alle und Keinen), is a work by German philosopher Friedrich Nietzsche, COMPOSED in four parts between 1883 and 1885. It famously declares that "God is dead", elaborates Nietzsche's conception of the will to power, and serves as an introduction to his doctrine of eternal return. Described by Nietzsche himself as "the deepest ever written", the book is a dense and esoteric treatise on philosophy and morality, featuring as protagonist a fictionalized Zarathustra. The text encompasses passages of poetry and song, often mocking Judaeo-Christian morality and tradition. well what i guess what im trina do is something like this .,.its not correct because i dont know what to do if %var% equ 0 set one=I like it cause of that to. if %var% equ 1 set one=eww, are you sure? if %var% equ 2 set one=Wow, never thought of that. if %var% equ 3 set one=Are you sure? echo %one% if if %var% equ 1 set one=eww, are you sure? goto h :h why do you think this? set /p choice= so like i want it that if the choice of if %var% equ 1 set one=eww, are you shurr? is picked i want that one to go to h and just that one. how do i do that if %var% equ 0 set one=I like it cause of that to. if %var% equ 1 set one=eww, are you shurr? if %var% equ 2 set one=Wow, never thought of that. if %var% equ 3 set one=Are you shurr? echo %one% if if %var% equ 1 set one=eww, are you shurr? & goto h goto skip :h why do you think this? set /p choice= :skip correct |
|