How to echo error from foreach loop?

HELP CODING: How to loop a code with "goto start"?

  • Help I want to do a prank on my friend by making him think he's been hacked. Ive posted this before but i did not understand the answer though they were very good. Okay, So Im making him think hes clicking on good chrome, because I saved a .bat file, renamed it Google Chrome and put the google chrome icon on it. Anyway the .bat file is supposed to make it so that when he clicks on it, it goes to a "press enter to continue"(Pause) Then go to a matrix code so he thinks hes been hacked THEN after like 5 seconds of looping the matrix code, have a window come up which tells him theres a virus and that his computer is shutting down (and it will shut down) What im having TROUBLE on is the looping of the matrix code. I want it to just loop like 5 or 10 times, instead of the original infinite times (just enough to make him freak out and think hes being hacked, but not like super long) heres the code i have so far: @echo off echo Warning: Internal Error. echo -------------------- echo This application could not be accessed due to a corrupt file within the hard echo drive. echo -------------------- echo Continuing will terminate the file permanently echo --------------------- pause @echo off color 02 :start echo %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% goto start shutdown -s -c "VIRUS DETECTED: Your computer is being shut down in order to prevent your hard drive from being erased!" BUT the thing is that it will NEVER go to the --- shutdown -s -c "VIRUS DETECTED: Your computer is being shut down in order to prevent your hard drive from being erased!"---- part because it keeps being countered by the "goto start" command . which goes to the start of the matrix code and keeps making it run forever so it never goes and shuts down the computer!!! Please if you know how to help me, COPY & PASTE the corrected code in your answer, and i will love you forever. Also, if you have any questions I will be sure to respond in the additional details section Thank you very much

  • Answer:

    @echo off set i=0 color 02 :start echo %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% set /A i=%i%+1 if %i%==5 goto end goto start :end echo "VIRUS DETECTED: Your computer is being shut down in order to prevent your hard drive from being erased!" ===== If you really are going to put this on your friend's PC, I suggest you just echo instead of shutdown. What if he just spent many hours doing a homework and have not save the file? He will lose all his work.

Yee at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.