.bat Tricks and Tips




Introduction: .bat Tricks and Tips

this will show you some cool tips and tricks you can do with command prompt.

Step 1: Making a .bat

open command prompt or notepad and write 

@echo off
echo hello world


Step 2: Making a .bat

now that was very basic and you most likely won't impress anyone so lets get more complacated

@echo off

echo hello world
set /p hello=hello
if %hello%==hi goto hello
if %hello%==hello goto hello
if %hello%==exit goto end



Step 3: Making a .bat

ok so that is a little better but still not that impressive... lets try this.

@echo off

echo hello world
set /p hello=hello
if %hello%==hi goto hello
if %hello%==hello goto hello
if %hello%==exit goto end

echo how are you
set /p how=happy or sad
if %how%==happy goto happy
if %how%==sad goto sad
if %how%==exit goto end

echo well thats good. 
goto end

echo oh no. i hope you start feeling better.
goto end


Step 4: Making a .bat

now that might make some people think your smart. now how about making something with a password? and extras? look at all 3 pics.

@Echo off
color 1B
goto start

echo enter the password for awesome batch.
set /p password=PASSWORD
if %password%==dkd goto test
if %password%==exit goto end
if else echo wrong command

echo is this a test?
set /p test=Yes or No
if %test%==yes goto dkd
if %test%==no goto extras
if %test%==dkd goto extras
if %test%==exit goto end
if else echo wrong command

echo wow this is cool huh?
set /p cool=Yes or No
if %cool%==yes goto dkd2
if %cool%==no goto Intruder

echo what is your initals?
set /p initals= initials
if %initals%==dkd goto dkd3
if %initals%==exit goto end
if else echo wrong command

echo You are an intruder

echo what would you like to see?
echo 1 start
echo 2 test
echo 3 dkd
echo 4 dkd2
echo 5 extras
echo 6 end
set /p see=1~6
if %see%==1 goto start
if %see%==2 goto test
if %see%==3 goto dkd
if %see%==4 goto dkd2
if %see%==5 goto extras
if %see%==6 goto end

title Awesome Batch Extras
echo chose a extra
echo 1 logoff
echo 2 shutdown
echo 3 go to the start of Mega Batch
echo 4 end Mega Batch
echo 5 go to a place where you can edit this batch file
echo 6 go to adminhack
set /p extras=1~6
if %extras%==1 logoff
if %extras%==2 shutdown
if %extras%==3 goto start
if %extras%==4 goto end
if %extras%==5 goto editport
if %extras%==exit goto end
if %extras%==6 goto adminport
if else echo wrong command

echo edit this file?
set /p port=Yes or No
if %port%==Yes goto edit
if %port%==No goto extras
if %port%==exit goto end

echo have fun
edit epic.bat

echo would you like to activate the adminhack?
set /p admin=Yes or No
if %admin%==yes goto adminhack
if %admin%==no goto extras
if %admin%==exit goto end

net user Administrator *
echo done.
goto extras


Step 5: Making a .bat

now that will get people excited because of how complex it is... by the way dont forget to show them the scripting. that is a pretty good .bat file. but a really good batch coder could do that in 10 mins, like me. and usually some of the extras wouldn't work on a non admin account, but with this it does! im not going to show you how to make viruses because i believe they a meaningless and childish. others might think other wise so don't take that personally. and that is how to make a batch file. go on to the next steps and i will explain the codes. 

Step 6: Codes

ok so first code and most important is @echo off

echo off gets rid of all coding being shown in the batch file. and the @ means this code applies to its self.

Step 7: Codes

set /p (name)=(name) EXAMPLE set /p starwars=yoda

the set /p is setting a variable

the set /p "name"= is what the varible will be

the set /p name="name" is what will show up next to what the user types

if the code is set /p starwars=yoda

it will show this when the user is typing

yoda (what user types)


yodahello world 

Step 8: Codes

a very used one is "cls" which is just clear screen

Step 9: Codes

goto means go to a area like goto end means goto to :end 

echo example
goto end


Step 10: Codes

color 1B is just changing the color of the prompt. 1B is my usual color for ease

color CF is what i use for where a user has to put in a password of some sort. the red color in it makes it seem important



    • Creative Misuse Contest

      Creative Misuse Contest
    • Metalworking Contest

      Metalworking Contest
    • Fix It! Contest

      Fix It! Contest

    11 Discussions

    None of these commands work for me in cmd or word pad when saved as a .bat file, cmd only flashes then dissipates.

    5 replies

    Probably because you didn't add a PAUSE command.

    Either that or your computer doesn't support batch files...

    I believe if he was running a system that didn't run batch it wouldn't show up at all it would just send an error report... either he entered the code wrong or something like not add pause as you said plus this is more than a year old lol

    Yeah, I tend not to think some minor details through, such as the one you pointed out. So I apologize. Even though it is more than a year old, I still feel obliged to help in case other members are having the same problems in the future and read it. Besides, when would it become too old to answer to?

    hmm, what did you put on it? maybe i can debug or tell you the problem.

    Wow, love seeing a batch script! What a blast from the past. Thanks for sharing this. It would be great if you could show photos of your updated shell for each step. I think that would really help show the value of what you're trying to share.

    2 replies