About this Tutorial
Batch Script
About this Tutorial
Batch Scripts are stored in simple text files containing lines with commands that get executed in sequence, one after the other. Scripting is a way by which one can alleviate this necessity by automating these command sequences in order to make one's life at the shell easier and more productive. This tutorial discusses the basic functionalities of Batch Script along with relevant examples for easy understanding.
Audience
This tutorial has been prepared for beginners to understand the basic concepts of Batch Script.
Prerequisites
A reasonable knowledge of computer programming and concepts such as variables, commands, syntax, etc. is desired.
Copyright & Disclaimer
Copyright 2016 by Tutorials Point (I) Pvt. Ltd. All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish any contents or a part of contents of this e-book in any manner without written consent of the publisher. We strive to update the contents of our website and tutorials as timely and as precisely as possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt. Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our website or its contents including this tutorial. If you discover any errors on our website or in this tutorial, please notify us at contact@
i
Batch Script
Table of Contents
About this Tutorial ...................................................................................................................................i Audience ..................................................................................................................................................i Prerequisites ............................................................................................................................................i Copyright & Disclaimer.............................................................................................................................i Table of Contents ....................................................................................................................................ii
1. BATCH SCRIPT ? OVERVIEW.................................................................................................1
2. BATCH SCRIPT ? ENVIRONMENT ......................................................................................... 2
Writing and Executing .............................................................................................................................2 Environment Variables ............................................................................................................................4
3. BATCH SCRIPT ? COMMANDS..............................................................................................5
ver ........................................................................................................................................................... 5 ASSOC .....................................................................................................................................................5 CD ...........................................................................................................................................................6 CLS ..........................................................................................................................................................7 Copy ........................................................................................................................................................7 DEL ..........................................................................................................................................................8 DIR ..........................................................................................................................................................9 DATE .......................................................................................................................................................9 ECHO .....................................................................................................................................................10 EXIT .......................................................................................................................................................11 MD ........................................................................................................................................................11 MOVE .................................................................................................................................................... 12 PATH .....................................................................................................................................................12 PAUSE ...................................................................................................................................................13 PROMPT ................................................................................................................................................ 13
ii
Batch Script
RD .........................................................................................................................................................14 REN .......................................................................................................................................................14 REM ......................................................................................................................................................15 START .................................................................................................................................................... 15 TIME ...................................................................................................................................................... 15 TYPE ......................................................................................................................................................16 VOL .......................................................................................................................................................16 ATTRIB ..................................................................................................................................................17 CHKDSK .................................................................................................................................................18 CHOICE ..................................................................................................................................................18 CMD ......................................................................................................................................................19 COMP .................................................................................................................................................... 19 CONVERT ............................................................................................................................................... 19 DRIVERQUERY .......................................................................................................................................20 EXPAND ................................................................................................................................................. 21 FIND ......................................................................................................................................................21 FORMAT ................................................................................................................................................ 21 HELP ...................................................................................................................................................... 22 IPCONFIG ..............................................................................................................................................23 LABEL ....................................................................................................................................................24 MORE .................................................................................................................................................... 24 NET .......................................................................................................................................................25 PING ...................................................................................................................................................... 27 SHUTDOWN ..........................................................................................................................................27 SORT .....................................................................................................................................................28 SUBST .................................................................................................................................................... 28 SYSTEMINFO .........................................................................................................................................28
iii
Batch Script
TASKKILL ...............................................................................................................................................29 TASKLIST ...............................................................................................................................................30 XCOPY ...................................................................................................................................................30 TREE ......................................................................................................................................................30 FC ..........................................................................................................................................................31 DISKPART ..............................................................................................................................................31 TITLE .....................................................................................................................................................32 SET ........................................................................................................................................................32
4. BATCH SCRIPT ? FILES........................................................................................................33
Creating Batch Files...............................................................................................................................33 Saving Batch Files..................................................................................................................................33 Executing Batch Files.............................................................................................................................34 Modifying Batch Files ............................................................................................................................35
5. BATCH SCRIPT ? SYNTAX....................................................................................................36
6. BATCH SCRIPT ? VARIABLES...............................................................................................37
Command Line Arguments ....................................................................................................................37 Set Command........................................................................................................................................38 Working with Numeric Values...............................................................................................................38 Local vs Global Variables .......................................................................................................................39 Working with Environment Variables....................................................................................................40
7. BATCH SCRIPT ? COMMENTS ............................................................................................ 41
Comments Using the Rem Statement....................................................................................................41 Comments Using the :: Statement.........................................................................................................42
8. BATCH SCRIPT ? STRINGS ..................................................................................................44
Create String .........................................................................................................................................44 Empty String..........................................................................................................................................44
iv
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- dosfuscation exploring the depths of obfuscation
- a quick guide to the winzip command line add on
- command line and automation tools
- about this tutorial
- list of ms dos commands
- creates a command prompt for running mcnp6
- draft purdue university
- freebsd command reference afnog
- creating a batch command file for executing sas with
- unix commands carnegie mellon university
Related searches
- this year s or this years
- free excel tutorial download pdf
- printable excel tutorial in pdf
- microsoft excel tutorial pdf download
- ms excel 2013 tutorial pdf
- free basic excel tutorial pdf
- this is he vs this is him
- about this topic
- this years or this year s grammar
- this years or this year s
- this year s vs this years
- what interest you about this position answer