Music Banter - View Single Post - The Official Computer Tech Support Thread
View Single Post
Old 02-02-2011, 06:36 PM   #799 (permalink)
Freebase Dali
Partying on the inside
 
Freebase Dali's Avatar
 
Join Date: Mar 2009
Posts: 5,584
Default

Quote:
Originally Posted by Dayvan Cowboy View Post
so, me and my friend are going to have a bit of fun with a useless old PC we found in her basement. So, we were going to write a malicious .bat file. I've done this before but it was a rather quick delete system32 thing so it wasn't very entertaining.

how do you make a batch file timed? I want some time before it sets in.
I haven't done any scripting for a batch file in ages, but I don't remember there being a wait command that ever worked for me.
The way most people end up doing it is to simply to ping your network card using a -n switch with the indicated number of seconds.

So if you want to wait for a period of time immediately after the bat executes, the first line of code you'd put in would be, using 60 seconds as an example:

ping 127.0.0.1 -n 60

Then you'd write your other lines of code afterward.
The only thing is it's going to sit there and ping & reply in the output window, which isn't an issue in itself and doesn't affect anything, but if you're trying to be sneaky, you may want to figure out how to make it so that the bat runs in the background or something, which I'm not sure how to do. You can probably find a tutorial on the web somewhere.
Freebase Dali is offline   Reply With Quote