5 Cool Batch Files

861,876

79

104

About: I am a computer "nerd" and I admit it...but if you see me on the street you will not know it...:)

In This instructable you will get 5 codes for 5 useful batch things

- Password Generator
- Password Protected Command Prompt
- Website Crasher
- Website Pinger
- PC Cleanup Utilities

Step 1: Password Generator


This Batch generates number only passwords. You can choose from 1, 5. or 10 passowrds to show...all random

Code:

@echo off
:Start2
cls
goto Start
:Start
title Password Generator
echo I will make you a new password.
echo Please write the password down somewhere in case you forget it.
echo ----------------------------------------­-----------------------
echo 1) 1 Random Password
echo 2) 5 Random Passwords
echo 3) 10 Random Passwords
echo Input your choice
set input=
set /p input= Choice:
if %input%==1 goto A if NOT goto Start2
if %input%==2 goto B if NOT goto Start2
if %input%==3 goto C if NOT goto Start2
:A
cls
echo Your password is %random%
echo Now choose what you want to do.
echo 1) Go back to the beginning
echo 2) Exit
set input=
set /p input= Choice:
if %input%==1 goto Start2 if NOT goto Start 2
if %input%==2 goto Exit if NOT goto Start 2
:Exit
exit
:B
cls
echo Your 5 passwords are %random%, %random%, %random%, %random%, %random%.
echo Now choose what you want to do.
echo 1) Go back to the beginning
echo 2) Exit
set input=
set /p input= Choice:
if %input%==1 goto Start2 if NOT goto Start 2
if %input%==2 goto Exit if NOT goto Start 2
:C
cls
echo Your 10 Passwords are %random%, %random%, %random%, %random%, %random%, %random%, %random%, %random%, %random%, %random%
echo Now choose what you want to do.
echo 1) Go back to the beginning
echo 2) Exit
set input=
set /p input= Choice:
if %input%==1 goto Start2 if NOT goto Start 2
if %input%==2 goto Exit if NOT goto Start 2

Step 2: Website Pinger

This Batch Pings a website you want and go to it at school

:A
@echo off
Title Website Pinger
color 0e
echo Enter the website you would like to ping
set input=
set /p input= Enter your Website here:
if %input%==goto A if NOT B
echo Processing Your request
ping localhost>nul
echo -------------------------------------------------------------------------------------
echo If you do not clost this in 45 seconds you will go to **ENTER WEBSITE HERE**
echo -------------------------------------------------------------------------------------
ping localhost>nul
echo This is the IP=
ping %input%
set input=
set /p input= If you want to open this adress please enter the IP here:
start iexplore.exe %input%
set input2=
set /p input2=
if %input% exit goto exit
ping localhost -n 45 >nul
start iexplore.exe **ENTER WEBSITE HERE**
exit
:exit
exit


Where it says "**ENTER WEBSITE HERE** put your website...if you dont have one delete both lines

Step 3: Website Crasher


This site is just like the Website pinger but insted of pinging it crashes it with 1000 data non stop

':A
@echo off
Title Website Crasher
color 0e
echo Enter the website you would like to crash
set input=
set /p input= Enter your Website here:
if %input%==goto A if NOT B
echo Processing Your request
ping localhost>nul
echo To end Crashing press CTRL + C
ping localhost>nul
cls
echo ----------------------------------------------------------------------
echo Now Crashing Website...DO NOT CLOSE THIS BOX!! PRESS CRTL + C TO END!!
echo ----------------------------------------------------------------------
ping %input% -t -l 1000

Step 4: Password Protected Command Prompt

This Command Prompt makes a user sign up then sign in to get the command prompt

in the command prompt type "red", "green", or "normal" without quotes and it changes the color


@echo off
:home
title Log in to CMD
color 07
cls
echo.
echo Cmd Accounts
echo =============
echo.
echo [1] Log In
echo [2] Sign Up
echo [3] Exit
echo.
set /p op=
if %op%==1 goto 1
if %op%==2 goto 2
if %op%==3 goto 3
goto error
:2
cls
echo Sign Up
echo ======================================
echo.
set /p newname="Enter new username:"
if "%newname%"=="%newname%" goto inputname
:inputname
cd "%userprofile%\documents"
if exist "cmdacoBin" goto skip
if not exist "cmdacoBin" goto noskip
:noskip
md "cmdacoBin"
goto skip
:skip
cd "%userprofile%\documents\cmdacoBin"
if exist "%newname%.bat" goto namexist
if not exist "%newname%.bat" goto skip2
:skip2
echo set realusername=%newname%> "%newname%.bat"
goto next
:next
echo.
set /p pswd=Enter new Password:
if "%pswd%"=="%pswd%" goto inputpass
:inputpass
cd "%userprofile%\documents\cmdacoBin"
echo set password=%pswd%>> "%newname%.bat"
goto next1
:namexist
echo.
echo The entered username already exists.
echo Press any key to return. . .
pause >nul
goto 2
:next1
cls
echo Cmd Accounts
echo ============
echo.
echo Your account has been successfully created!
echo.
pause
goto home
:1
color 07
cls
echo Cmd Accounts Log In
echo ================================
echo.
Set /p logname=Username:
if "%logname%"=="%logname%" goto 2.1
:2.1
echo.
set /p logpass="Password:"
if "%logpass%"=="%logpass%" goto login
:login
cd "%userprofile%\documents\cmdacoBin"
if exist "%logname%.bat" goto call
if not exist "%logname%.bat" goto errorlog
:call
call "%logname%.bat"
if "%password%"=="%logpass%" goto logdone
goto errorlog
:errorlog
color 0c
echo.
echo Username or Password incorrect.
echo Access denied.
pause >nul
goto home
:logdone
cls
echo Command Prompt
echo ==============
echo.
echo Successfully logged in!
echo.
pause
goto account
:account
cls
cd "%userprofile%\documents\cmdacoBin"
call "%realusername%color.bat"
call "%realusername%.bat"
color %colorcode%
cls
echo.
echo -------------------------------------------------------------------------------
echo %realusername%
echo -------------------------------------------------------------------------------
@echo off
break off
Title Command Prompt
color 0a
cls

echo Type "home" any time to go to the current user profile directory.
echo Type "desktop" any time to go to the current user desktop.
echo.
echo Type help to see list of common commands like cd, rd, md, del,
echo ren, replace, copy, xcopy, move, attrib, tree, edit, and cls.
echo Type [command]/? for detailed info.
echo.
pause
cls

:cmd
echo Directory: %CD%
set /P CMD=Command:
if "%CMD%" == "cls" goto cls
if "%CMD%" == "home" goto home2
if "%CMD%" == "desktop" goto desktop
if "%CMD%" == "red" goto red
if "%CMD%" == "green" goto green
if "%CMD%" == "normal" goto normal

%CMD%
cd C:\
goto cmd

:cls
cls
goto cmd

:home2
cd /d %USERPROFILE%
cls
goto cmd

:desktop
cd /d %SystemDrive%\Users\%USERNAME%\Desktop
cls
goto cmd

:red
color 0c
cls
goto cmd

:green
color 0a
cls
goto cmd

:normal
color 07
cls
goto cmd

Step 5: PC Cleanup Utility

This Batch is my favorate and it will

-Delete Internet cookies
-Delete Temporary Files
-Defrag Disk
-Cleanup Disk

@echo off
title PC Cleanup Utility http://www.youtube.com/user/techki-tv

:menu
cls
echo --------------------------------------------------------------------------------
echo PC Cleanup Utility
echo --------------------------------------------------------------------------------
echo.
echo Select a tool
echo =============
echo.
echo [1] Delete Internet Cookies
echo [2] Delete Temporary Internet Files
echo [3] Disk Cleanup
echo [4] Disk Defragment
echo [5] Exit
echo.
set /p op=Run:
if %op%==1 goto 1
if %op%==2 goto 2
if %op%==3 goto 3
if %op%==4 goto 4
if %op%==5 goto exit
goto error
:1
cls
echo --------------------------------------------------------------------------------
echo Delete Internet Cookies
echo --------------------------------------------------------------------------------
echo.
echo Deleting Cookies...
ping localhost -n 3 >nul
del /f /q "%userprofile%\Cookies\*.*"
cls
echo --------------------------------------------------------------------------------
echo Delete Internet Cookies
echo --------------------------------------------------------------------------------
echo.
echo Cookies deleted.
echo.
echo Press any key to return to the menu. . .
pause >nul
goto menu
:2
cls
echo --------------------------------------------------------------------------------
echo Delete Temporary Internet Files
echo --------------------------------------------------------------------------------
echo.
echo Deleting Temporary Files...
ping localhost -n 3 >nul
del /f /q "%userprofile%\AppData\Local\Microsoft\Windows\Temporary Internet Files\*.*"
cls
echo --------------------------------------------------------------------------------
echo Delete Temporary Internet Files
echo --------------------------------------------------------------------------------
echo.
echo Temporary Internet Files deleted.
echo.
echo Press any key to return to the menu. . .
pause >nul
goto menu
:3
cls
echo --------------------------------------------------------------------------------
echo Disk Cleanup
echo --------------------------------------------------------------------------------
echo.
echo Running Disk Cleanup...
ping localhost -n 3 >nul
if exist "C:\WINDOWS\temp"del /f /q "C:WINDOWS\temp\*.*"
if exist "C:\WINDOWS\tmp" del /f /q "C:\WINDOWS\tmp\*.*"
if exist "C:\tmp" del /f /q "C:\tmp\*.*"
if exist "C:\temp" del /f /q "C:\temp\*.*"
if exist "%temp%" del /f /q "%temp%\*.*"
if exist "%tmp%" del /f /q "%tmp%\*.*"
if not exist "C:\WINDOWS\Users\*.*" goto skip
if exist "C:\WINDOWS\Users\*.zip" del "C:\WINDOWS\Users\*.zip" /f /q
if exist "C:\WINDOWS\Users\*.exe" del "C:\WINDOWS\Users\*.exe" /f /q
if exist "C:\WINDOWS\Users\*.gif" del "C:\WINDOWS\Users\*.gif" /f /q
if exist "C:\WINDOWS\Users\*.jpg" del "C:\WINDOWS\Users\*.jpg" /f /q
if exist "C:\WINDOWS\Users\*.png" del "C:\WINDOWS\Users\*.png" /f /q
if exist "C:\WINDOWS\Users\*.bmp" del "C:\WINDOWS\Users\*.bmp" /f /q
if exist "C:\WINDOWS\Users\*.avi" del "C:\WINDOWS\Users\*.avi" /f /q
if exist "C:\WINDOWS\Users\*.mpg" del "C:\WINDOWS\Users\*.mpg" /f /q
if exist "C:\WINDOWS\Users\*.mpeg" del "C:\WINDOWS\Users\*.mpeg" /f /q
if exist "C:\WINDOWS\Users\*.ra" del "C:\WINDOWS\Users\*.ra" /f /q
if exist "C:\WINDOWS\Users\*.ram" del "C:\WINDOWS\Users\*.ram"/f /q
if exist "C:\WINDOWS\Users\*.mp3" del "C:\WINDOWS\Users\*.mp3" /f /q
if exist "C:\WINDOWS\Users\*.mov" del "C:\WINDOWS\Users\*.mov" /f /q
if exist "C:\WINDOWS\Users\*.qt" del "C:\WINDOWS\Users\*.qt" /f /q
if exist "C:\WINDOWS\Users\*.asf" del "C:\WINDOWS\Users\*.asf" /f /q
:skip
if not exist C:\WINDOWS\Users\Users\*.* goto skippy /f /q
if exist C:\WINDOWS\Users\AppData\Temp\*.zip del C:\WINDOWS\Users\Users\*.zip /f /q
if exist C:\WINDOWS\Users\AppData\Temp\*.exe del C:\WINDOWS\Users\Users\*.exe /f /q
if exist C:\WINDOWS\Users\AppData\Temp\*.gif del C:\WINDOWS\Users\Users\*.gif /f /q
if exist C:\WINDOWS\Users\AppData\Temp\*.jpg del C:\WINDOWS\Users\Users\*.jpg /f /q
if exist C:\WINDOWS\Users\AppData\Temp\*.png del C:\WINDOWS\Users\Users\*.png /f /q
if exist C:\WINDOWS\Users\AppData\Temp\*.bmp del C:\WINDOWS\Users\Users\*.bmp /f /q
if exist C:\WINDOWS\Users\AppData\Temp\*.avi del C:\WINDOWS\Users\Users\*.avi /f /q
if exist C:\WINDOWS\Users\AppData\Temp\*.mpg del C:\WINDOWS\Users\Users\*.mpg /f /q
if exist C:\WINDOWS\Users\AppData\Temp\*.mpeg del C:\WINDOWS\Users\Users\*.mpeg /f /q
if exist C:\WINDOWS\Users\AppData\Temp\*.ra del C:\WINDOWS\Users\Users\*.ra /f /q
if exist C:\WINDOWS\Users\AppData\Temp\*.ram del C:\WINDOWS\Users\Users\*.ram /f /q
if exist C:\WINDOWS\Users\AppData\Temp\*.mp3 del C:\WINDOWS\Users\Users\*.mp3 /f /q
if exist C:\WINDOWS\Users\AppData\Temp\*.asf del C:\WINDOWS\Users\Users\*.asf /f /q
if exist C:\WINDOWS\Users\AppData\Temp\*.qt del C:\WINDOWS\Users\Users\*.qt /f /q
if exist C:\WINDOWS\Users\AppData\Temp\*.mov del C:\WINDOWS\Users\Users\*.mov /f /q
:skippy
if exist "C:\WINDOWS\ff*.tmp" del C:\WINDOWS\ff*.tmp /f /q
if exist C:\WINDOWS\ShellIconCache del /f /q "C:\WINDOWS\ShellI~1\*.*"
cls
echo --------------------------------------------------------------------------------
echo Disk Cleanup
echo --------------------------------------------------------------------------------
echo.
echo Disk Cleanup successful!
echo.
pause
goto menu
:4
cls
echo --------------------------------------------------------------------------------
echo Disk Defragment
echo --------------------------------------------------------------------------------
echo.
echo Defragmenting hard disks...
ping localhost -n 3 >nul
defrag -c -v
cls
echo --------------------------------------------------------------------------------
echo Disk Defragment
echo --------------------------------------------------------------------------------
echo.
echo Disk Defrag successful!
echo.
pause
goto menu
:error
cls
echo Command not recognized.
ping localhost -n 4 >nul
goto menu
:exit


echo Thanks for using PC Cleanup Utility by Ryan
ping 127.0.0.1 >nul
exit

Step 6: BYE!!!


Thanks for viewing my 1st instructable and check out my youtube

http://www.youtube.com/techkitv

Share

Recommendations

  • First Time Author

    First Time Author
  • Big and Small Contest

    Big and Small Contest
  • PCB Contest

    PCB Contest

104 Discussions

0
None
DylanM114

Tip 5 months ago

I modified the login process, it had some syntax errors from just pressing enter, pressing space and then enter, and I also added a log to keep track of if you're login in, so you can close the batch file and not have to login again unless you actually logout. I also added a msgbox box using basic VBS scripting so the error messages have a msgbox popup instead of it printing on the screen, it seemed more professional. I've also shortened the login process because there was unnecessary code in the original one. Also, its easier to view the code with Notepad++ if you want to easily look at whats going on.. I made plenty of notes to explain the process and also keep it easier for me to remember and visually see whats going on, its not as easy to view whats going on before you run them on your computer using windows notepad. I hope all of you actually read the code before running it.

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

@echo off

title Login

color 1f

::logs in user who it says is logged in

::Login---------------------------------------------------------------------------------

::Login---------------------------------------------------------------------------------

::Login---------------------------------------------------------------------------------

::Login---------------------------------------------------------------------------------

:home

cls

echo.

echo Accounts

echo.

echo.

echo [1] Log In

echo [2] Sign Up

echo [3] Exit

echo.

echo.

::sets the option to something random to prevent just pressing enter syntax error

set option=njckasldnfvkjasnlkjdfnlkadvn

set /p option=-

if "%option%"=="njckasldnfvkjasnlkjdfnlkadvn" goto homeerror

if "%option%"=="1" goto login

if "%option%"=="2" goto signup

if "%option%"=="3" exit

::Error message

:homeerror

echo msgbox "Error! Invalid Entry." > %tmp%\tmp.vbs

cscript /nologo %tmp%\tmp.vbs

del %tmp%\tmp.vbs

goto home

::Sign Up---------------------------------------------------------------------------------

:signup

cls

echo.

echo Sign Up

echo.

echo.

set /p newname=Enter your new username:

::Checks to see if user already exists

if exist %USERPROFILE%\AccountBin\%newname%\%newname%.bat goto namexists

::Creates directory

md %USERPROFILE%\AccountBin\%newname%

::Changes directory to newly made directory

cd %USERPROFILE%\AccountBin\%newname%

::Creates users username and password in a batch file

echo set realusername=%newname%>> %newname%.bat

echo.

set /p newpassword=Enter your new Password:

echo set logpass=%newpassword%>> %newname%.bat

cls

echo msgbox "Your account has been successfuly created!" > %tmp%\tmp.vbs

cscript /nologo %tmp%\tmp.vbs

del %tmp%\tmp.vbs

goto home

:namexists

cls

echo msgbox "%newname% already exists." > %tmp%\tmp.vbs

cscript /nologo %tmp%\tmp.vbs

del %tmp%\tmp.vbs

goto home

::Login---------------------------------------------------------------------------------

:login

cls

echo.

echo Log In

echo.

echo.

set /p username=Username:

set /p password=Password:

cd %USERPROFILE%\AccountBin\%username%

::Checks to see if User exists

if not exist "%username%.bat" goto loginerror

::Checks the password inside the users batch file

call %username%.bat

if "%password%"=="%logpass%" (

cd %USERPROFILE%\AccountBin\

echo set whosloggedin=%username%>> loggedin.bat

goto account

)

:loginerror

cls

echo msgbox "Username or password is incorrect, please try again." > %tmp%\tmp.vbs

cscript /nologo %tmp%\tmp.vbs

del %tmp%\tmp.vbs

goto home

::Account---------------------------------------------------------------------------------

::Account---------------------------------------------------------------------------------

::Account---------------------------------------------------------------------------------

::Account---------------------------------------------------------------------------------

::Account---------------------------------------------------------------------------------

::Account---------------------------------------------------------------------------------

::Account---------------------------------------------------------------------------------

::Account---------------------------------------------------------------------------------

:account

cd %USERPROFILE%\AccountBin\%realusername%

title %realusername%

cls

echo.

echo What Would You Like To Do %realusername%?

echo.

echo.

echo [1] Logout

echo [2] Exit

echo.

echo.

::sets the choice to something random to prevent just pressing enter syntax error

set choice=njckasldnfvkjasnlkjdfnlkadvn

set /p choice=-

if "%choice%"=="njckasldnfvkjasnlkjdfnlkadvn" goto accounterror

if "%choice%"=="1" goto logout

if "%choice%"=="2" exit

::Error

:accounterror

echo msgbox "Error! Invalid Entry." > %tmp%\tmp.vbs

cscript /nologo %tmp%\tmp.vbs

del %tmp%\tmp.vbs

goto account

:logout

cls

del %USERPROFILE%\AccountBin\loggedin.bat

goto home

0
None

i found not all work and some excess code was added

I take this comment ironicly but I still have to say it. That "website crasher" does not work.

0
None
Code_Master

5 years ago on Step 2

testicleboy, you should never post this much crud on a forum page, it is completely unnecessary, put it in a file and upload it and then put the link!, on the page. Here, since you did anyways, i reduced your mountain and made some tweaks that i hope even you can follow simply. and it works BTW, Download it Here: http://www.2shared.com/file/KA4t9WIo/Loading.html , the download link is the small blue button at the bottom of the page it says download on it. GoodLuck :)

4 replies
0
None
RW4Code_Master

Reply 3 years ago on Step 2

The reason why people post code instead of the bat is because if you don't know if they made a malicious file or not and you don't want to accidentally autorun.

0
None
AndrewV10RW4

Reply 3 years ago

Fyi you can click edit when you download it, and read the code

0
None
d34dh4ck3rw4nn4b3AndrewV10

Reply 1 year ago

He said that you do not want to accidentaly run it in case it is malicious.

But Code_Master you are right about not posting this much on a forums page though you dont want to download it because of what I just wrote. Instead you could have text files for each code explaining what it does and giving you the code in the same file.

0
None
Code_MasterCode_Master

Reply 5 years ago on Step 2

Hey everyone this is the Code_Master giving you an updated Pinger, i just took this guys pinger deleted all but like 3 lines and wala made it probably 340% better! ENJOY!
Download Link: http://www.2shared.com/file/EDw0o46c/Pinger.html

0
None
d34dh4ck3rw4nn4b3JamesD273

Reply 1 year ago

Says it cn not find a what? You need to give more information for me to help you.

Also Website crasher does not work, read some of my and other peoples comments that explains why it doesnt work.

I know this is 6 years ago but I will still answer in case someone saw this comment and thought the same.
What is shown is a code that pings until you tell it to stop. It is now good to know that when you ping it waits for an "answer" and then it can ping again.
Read more about DDos to understand how to "crash" a website.

0
None
radametesladude123

Reply 7 years ago on Step 3

it takes a while...a doss atack is like 1 out of 10 chance that it will...luckly it does bcause I shut down a website for 3 hours...

0
None
SamiS46radame

Reply 2 years ago

Are there any required computer specs?

0
None
XiloPacradame

Reply 4 years ago on Step 3

It is properly pronounced "DOS" or Denial Of Service. Not doss.

0
None
032827XiloPac

Reply 3 years ago on Introduction

Actually child Dos is just a denial of service and ddos is a distributed denial of service attack