| 1. |
Solve : Random words in batch?? |
|
Answer» Hey ppl, Im sorry but could u please explain it? For example, what i am supposed to write in list.txt? And how does it work?So, I will start off explaining what NEEDS to be in list.txt. This is what you could put in list.txt Quote 1 Word1 Now, I will re-post the script, with comments explaining how the code works. @echo off rem Turns echoing commands on-screen to off. set /a rnd=%random%%%10 rem Gets a random number from 1-10. for /f "tokens=1,2" %%a in (list.txt) do if %rnd%==%%a echo %%b rem Taking the first two tokens of each line in list.txt delimited by spaces, rem it will check if the first word is the same as the random number, and if it is, rem it will display the SECOND word. rem pauseOh, ok I get it now. Thanks a lot, problem solved! |
|