Welcome to Cody`s list of useful Batch files!


Just copy the codes and save them as anything you want, but it must have the .bat extension. Example: program1.bat

Here is a batch file that allows you to hide information from other users of your computer, it`s also useful for hiding a password to a recently made account until you have it down pat.
Note that if you enter it incorrectly the specified number of tries, your computer will shutdown, to stop this, click start click run type in "shutdown -a" without the quotes.
Switch YOURPASSWORDHERE with your password. Then change "Ha there never really was a secret file!" to the information you want hidden. go to http://www.f2ko.de/English/b2e/download.php and download the .bat to .exe converter, This is very important because otherwise all someone has to do to view your password is right click on it and hit "edit".

@echo off
color 0a
::
set tries=4
:top
set /a tries=%tries% -1
if %tries%==0 (
goto penalty
)
Echo You have %tries% attempts left.
Echo Input password to continue.
set /p password=
if %password%==YOURPASSWORDHERE! (
Echo Haha, there never really was a secret file.!
) else (
goto top
)
goto top
Echo Blah blah blah.
:penalty
SHUTDOWN -S -F -T 60 -C "This is your punishment for attempting to access my secret data."



This one is a calculator. What makes this better then the Windows calculator is that you can preform multiple calculations at once, though sometimes it has errors dividing.

@ECHO OFF
:start ECHO Cody`s calculator version 1.5
ECHO.
:first
SET /p UDefine=
SET /a UDefine=%UDefine%
ECHO =
ECHO %UDefine%
ECHO.
PAUSE
CLS
ECHO Would you like to do another problem?
ECHO Y/N
SET /p again=
IF %again% EQU y GOTO start
IF %again% EQU n GOTO close
IF %again% GTR y GOTO start
IF %again% LSS y GOTO start
IF %again% GTR n GOTO start
IF %again% LSS n GOTO start



This one will switch your IP if you use it several times. Note that it will not work if you have a static IP.

Echo ipconfig/flushdns
ipconfig/flushdns
echo ipconfig/release
ipconfig/release
echo ipconfig/renew
ipconfig/renew
exit




The following is just a Command Prompt shell, just like your normal Windows XP shell. The difference is it works even if your computer prevents you from accessing Command Prompt.

@ECHO OFF
ECHO Welcome to Cody`s own little Command Prompt shell.
command.com



This one shuts your computer down if for some reason or another it won`t. (Or if you just wanna skip those asinine Windows updates :P.)

@echo off
echo Cody`s easy-off shutdown system version 1.0
:top
echo --------------------------------------------------------------------------------
echo /-Exit = 1
echo /-Shutdown = 2
echo /-Restart = 3
echo /-Log off = 4
echo.
echo --------------------------------------------------------------------------------
set variable1=1
set variable2=2
set variable3=3
set variable4=a
set variable5=4
set /p udefine=
if %udefine%==%variable1% (
goto exit
)
if %udefine%==%variable2% (
goto shutdown
)
if %udefine%==%variable3% (
goto restart
)
if %udefine%==%variable4% (
goto abort
)
if %udefine%==%variable5% (
goto logoff
)
:shutdown
shutdown -f -s -t 30 -c "Computer is shutting down, Press a to abort"
goto top
:restart
shutdown -f -r -t 30 -c "Computer is restarting, Press a to abort"
goto top
:abort
shutdown -a
goto top
:logoff
shutdown -f -l -t 30 -c "Computer is logging off, Press a to abort"
goto top
:exit
exit



This one is similar to the password protected text Batch, but it locks FOLDERS, not just text =-).

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 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.
pause
goto CONFIRM
:LOCK
ren Locker "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 password to Unlock folder
set/p "pass=>"
if NOT %pass%==YOUR PASSWORD HERE goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Locker
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
Shutdown -s -t 30
pause
goto end
:MDLOCKER
md Locker
echo Locker created successfully
pause
goto End
:End



This file will delete everything in the Windows blocked site file.



@echo off
ECHO Cody`s Firewall-Get-Arounder.
cd\
cd WINDOWS
cd SYSTEM32
cd DRIVERS
cd ETC

attrib -r -h
del hosts
ECHO Done!
pause



The following is an easy to learn, but challenging to master game. I recommend you leave it as a batch file
so you can change the highest possible number. Useful if you want to play with friends.

@ECHO OFF
:pick
SET /a answer=%RANDOM%
IF %answer% GTR 100 GOTO pick
IF %answer% EQU 0 GOTO pick
ECHO I`m thinking of a number between 1 and 100.
ECHO Guess which number I am thinking of.

: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 win! The Answer was %Answer%
ECHO It took you %GuessNum% guesses. ECHO. PAUSE CLS ECHO Would you like to play again?
ECHO Y/N?
SET /p play=
IF %play% EQU y GOTO pick
IF %play% EQU n GOTO close
IF %play% GTR y GOTO pick
IF %play% LSS y GOTO pick
IF %play% GTR n GOTO pick
IF %play% LSS n GOTO pick



This one will allow you to easily search Wikipedia from you desktop.

@echo off
Color 1b
Title Wikipedia Searcher
echo Enter your search topic:
set /p topic=
start http://en.wikipedia.org/wiki/%topic%

This will make a nameless Batch file you can edit by right-clicking on it & selecting "edit" from the drop-down list.

@echo off
copy %0 .bat



This one is uses your Command Prompt Telnet client to connect you to Net Hack. (An rpg game you play through Telnet.)

Telnet nethack.alt.org