Basic Batch Coding
by ThatHacker-Hackers United in Circuits > Computers
238 Views, 5 Favorites, 0 Comments
Basic Batch Coding
This Tutorial Will Introduce Basic Batch Commands
The Commands
@echo off - This gets rid of that c:\documents...etc
echo - This displays a message, (i.e "echo hello" = "hello") because if you type "hello" into CMD it will interpret "hello" as the command
cls - Clears the CMD of all text.
color - Changes the color (type "help color" for a list of colors).
goto - Goes to a particular statement in your text
pause - Pauses the command prompt and displays the message: Press any key to continue
if - A basic if Command
If not - a basic if not command
md/mkdir - makes a folder
set /p input=: - Prompts for User Input
set /a result=: - Does Math
%input% = the user input
color - changes color
:place - A seperate section in a batch file;most commonly used with goto
Basic Batch File (Password)
This is a simple Password Batch file
@echo off
:passenter
color B
echo Enter Password
set /p pass=:
IF %pass% == password GOTO :passdone
IF NOT %pass% == password GOTO :passx
:passdone
Color a
echo correct password
pause
:passx
color c
echo Incorrect Password
pause
GOTO :passenter
Basic Batch File (Calculator)
This is a simple calculator that only does addition others are more complex
@echo off
:home
color B
echo Enter Number One
set /p N1=:
echo Enter Number Two
set /p N2=:
set /A result=: %N1% + %N2%
echo %result%
pause
GOTO :home
Basic Batch File (Folder Maker)
@echo off
:Top
color B
echo Enter Folder Name
set /p name=:
md %name%
echo Folder Made
pause
GOTO :Top
Your Done!
These are simple Batch Files. I hope you learned something!