Saved Bookmarks
| 1. |
Solve : Batch random answer?? |
|
Answer» How can I make a batch that GIVES a random answer? How can I make a batch that gives a random answer? This should help you get started. It will probably work better with more answers. Use ctl+C to end execution. Note: intHighNumber must equal the number of answers for this to work correctly. Code: [Select]echo off setlocal set intLowNumber=1 set intHighNumber=3 set ans.1=I am fine set ans.2=I am lousy set ans.3=I am indifferent :loop echo How Are You TODAY? set /a rnd=%random% %% (%intHighNumber% - %intLowNumber% + 1) + %intLowNumber% call echo %%ans.%rnd%%% ping -N 3 localhost > nul goto loop Quote IF /I "%chat%" (is containing pf and nothing else) if "%chat%"=="pf" echo bored? Not using the /i switch requires an exact match for the condition to be true (pf==pf). Using the /i switch make the comparison case insensitive (pf==PF) hey thx, you really UNDERSTAND these things |
|