[Help] Joke with cmd from network
Maxime
-
Maxime -
Maxime -
Hello everyone (yes, there are quite a few qualified young ladies in IT ;) )
So in class, we use the command line of our virtual machines that are networked to chat, and I created a small .bat software that allows me to chat with my friends
and I got the idea to "troll" them with a loop of messages where I choose the number at the start!
But I've run into various problems, first of all, the if statements are very restrictive and if I understood correctly, it only accepts one command at a time. Then I found a technique online which is the if [command] Goto X that apparently works, but my software crashes and I can't find the solution! Here is the script:
Configuration: Windows XP / Firefox 16.0
So in class, we use the command line of our virtual machines that are networked to chat, and I created a small .bat software that allows me to chat with my friends
and I got the idea to "troll" them with a loop of messages where I choose the number at the start!
But I've run into various problems, first of all, the if statements are very restrictive and if I understood correctly, it only accepts one command at a time. Then I found a technique online which is the if [command] Goto X that apparently works, but my software crashes and I can't find the solution! Here is the script:
@echo off :A Cls set c=0 set e=1 echo ************************** echo * * echo * MESSENGER * echo * * echo ************************** echo "Do you want a Trolling message" Set /p r=response: if %r%==yes Goto B if %r%==no Goto C :B set /p i=Number_of_sends: set /p n=User: set /p m=Message: :D net send %n% %m% %c%==%c%+%e% if %i%<%c% Goto D if %i%==%c% Goto A :C set /p n=User: set /p m=Message: net send %n% %m% pause Goto A
Configuration: Windows XP / Firefox 16.0
2 réponses
I tested a new syntax, but still no result!
echo "Do you want a Trolling message" Set /p r=response: if %r%==yes Goto B if %r%==no Goto C :B set /a i=Num_sends: set /p n=User: set /p m=Message: :E net send %n% %m% Goto D :C set /p n=User: set /p m=Message: net send %n% %m% pause Goto A :D set loop=%loop%+%e% if (%loop%<%i%)(Goto E) else (pause) Goto A
Hi
When you say the software crashes, what are the symptoms?
It seems to me that to test strings you have to do:
IF %var% EQU "string"
When you say the software crashes, what are the symptoms?
It seems to me that to test strings you have to do:
IF %var% EQU "string"
Yes, I tried the set /a but it doesn't work, the message sends fine once but then the cmd closes!
Thanks Dubeck, apparently your solution works, here is my final code:
Thanks Dubeck, apparently your solution works, here is my final code:
@echo off :A Cls set /a boucle=0 set /a e=1 echo ************************** echo * * echo * MESSENGER * echo * * echo ************************** echo "Do you want a Trolling message" Set /p r=response o/n: if %r%==o Goto B if %r%==n Goto C :B set /p i=Number_of_sends: set /p n=User: set /p m=Message: :E net send %n% %m% Goto D :C set /p n=User: set /p m=Message: net send %n% %m% pause Goto A :D set /a boucle=%boucle%+%e% if %boucle% LSS %i% (Goto E) else (pause) Goto A