Modern Batch Scripting PDF
Modern Batch Scripting PDF
Modern Batch Scripting PDF
BATCH
SCRIPTING
Prince Patel
Modern
Batch
Scripting
A Basic
Guide
Prince Patel
Make It Easier To
Understand Batch
Scripting.
That Is Still Much Used. Batch Scripting Is Cool It Can Run Everywhere. If You
Want To Use Linux
Facebook Profile.
Message Me
What's Desi Programmer?
Real World.
Be With Us
Learn With Us
Build With Us
Connect With Us
Youtube English
Youtube Hindi
T A B L E O F C O N T E N T S
Basic Commands
Printing Text
If statements
Try It Yourself
Advanced If Statements
If-Else Block
Nested If Else
Loops
Debugging
To Do
Quiz
Before We Begin...
~Author☺
@echo off
pause
@echo off
d:
md Important
cd Important
cd Images
md New Old
cd..
cd Videos
md New Old
cd..
cd Files
md New Old
pause
Now Run Both The Files, You Can See That
Environment
Command Prompt.
Looks Like.
Command Prompt.
Watch Now. ☺☺
Command Prompt.
Start> Programs>Notepad.
Text On Screen
Echo.
Command.
Running.
comments
These
10
Better Understanding.
Click To Watch.
Modern Batch Scripting
11
Variables
Name.
"Enter A Number" Will Be Prompted When You Run The Batch Script.
12
set \a %calc%=%var% + 1
13
Variable We Have To Use 2 "%" Before And After The Valuable Name With The
Echo
14
Running.
15
goto
:a
16
if statement
Too.
If Command.
Becomes True.
17
A Work
Thinking Ability.
18
CODE 1
@echo off
:start
echo.
goto %var%
:1
cls
Color 08
%random%
pause
cls
goto start
:2
cls
Color 7C
%random%
pause
cls
goto start
20
CODE 2
@echo off
:start
echo.
goto %var%
cls
:c
c:
dir
pause
cls
goto start
:d
D:
dir
21
pause
cls
goto start
:e
E:
dir
pause
cls
goto start
:f
F:
dir
pause
cls
goto start
:exit
exit
22
23
24
Relational Operators
LSS : Checks to see if the left object is less than the right operand
Logical Operators
25
Statement.
@echo off
pause
exit
26
@echo off
pause
exit
It Will Print "You Guessed It Correct" And If It Enters Any Other Number Then
It Will Print
"So Sorry".
27
@echo off
set var=variable
"Var" Named Variable And Since Present Prints Var Named Variable Defined.
28
Statement.
@echo off
Line.
29
looping
command
30
31
Through 2,147,483,647)
Certain Limits.
32
@echo off
pause
33
files
In A File In Batch
34
set text==%%a
"Nope")
pause
35
Executed.
I Am An Independent
Writer.
Connect me To Support
Me.
620
debugging
Prompt.
First
37
Command Prompt.
@echo off
echo hii
pause
Time.
38
Program, Now You Might Be Able To Feel Ok To
39
To Learn About
Batch Files
Click Here.
40
Programmer
> Tutorials
>E-Books
>Magazines
>Inspiration
>Tech news
>Quizzes
PLAY THE C
PROGRAMMING
QUIZ
click this
41
42
43
Friends.
@echo off
:lolipop
echo.
set /p feeling=
goto lolipop
:lol
echo.
set /p name=
set /p team=
set /p browser=
goto fun
:fun
echo.
pay!!!
goto shutdown
:shutdown
echo.
echo ready?
set /p answer=
:sad
Modern Batch Scripting
45
echo.
goto lol
:delete
color 0D
echo.
echo ok,chow!!!
%random% %random%
goto random
:random
color 0A
echo.
46
%random% %random%
goto werdy
:sad2
echo.
goto delete
:werdy
47
color 2A
echo.
%random% %random%
goto random
48
@echo off
:a
color 2
echo 1 1 1 0 1 0 0 0 1 1 1 1 0 0 0 1 1 0 0 1 0 0 0 1 1 0 1 0 1 0
0 0 1 1 1 1
echo 1 1 0 1 1 1 0 0 0 1 0 1 a f h 0 0 0 1 0 1 1 0 0 1 1 1 0 0
1 0 1 0 0 1 1 0
echo 1 0 0 1 1 0 9 8 1 2 0 1 9 9 2 1 1 1 0 0 1 0 1 1 1 0 1 1 0
1 0 0 0 1 0 1 1
echo 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 1 0 0 1 0 1 0 1 1 0 1 0 0 0
01 0 1 0 0 1 0
2 1 2 3 2 1 3 4
echo 1 1 1 0 1 0 0 1 0 0 0 1 1 1 0 0 1 1 1 4 1 2 1 1 2 0 1 0 1 2
2 1 0 1 1 0 1
goto a
49
say?”,”Speak to Me”)
Set sapi=CreateObject(“sapi.spvoice”)
sapi.Speak message
=wscript.CreateObject(“WScript.Shell”)
do
wscript.sleep 100
wshshell.sendkeys “{CAPSLOCK}”
wshshell.sendkeys “{NUMLOCK}”
wshshell.sendkeys “{SCROLLLOCK}”
loop
50
Click the file and your all three LED lights will
start dancing.
@ECHO OFF
:BEGIN
MSG * HI
MSG * I AM!
GOTO BEGIN
51
@ECHO OFF
:TOP
START
%SYSTEMROOT%\SYSTEM32\NOTEPAD.EXE
GOTO TOP
Modern Batch Scripting
52
Other Software
Text
Channel.
KEEP LEARNING
KEEP SHARING