0% found this document useful (0 votes)
7 views

Batch_Scripting_Commands

This document is a guide to batch scripting commands, detailing various commands such as ECHO, CLS, PAUSE, and SET along with their descriptions and examples. It covers commands for displaying messages, managing files and directories, and controlling the flow of batch scripts. The guide serves as a reference for users to understand and utilize batch scripting effectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Batch_Scripting_Commands

This document is a guide to batch scripting commands, detailing various commands such as ECHO, CLS, PAUSE, and SET along with their descriptions and examples. It covers commands for displaying messages, managing files and directories, and controlling the flow of batch scripts. The guide serves as a reference for users to understand and utilize batch scripting effectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Batch Scripting Commands Guide

ECHO

Description: Displays messages or turns command echoing on/off.

Example: ECHO Hello, World!

CLS

Description: Clears the screen.

Example: CLS

PAUSE

Description: Pauses the execution of a batch file and displays a message.

Example: PAUSE

REM

Description: Inserts comments in a batch file.

Example: REM This is a comment

SET

Description: Sets or displays environment variables.

Example: SET PATH=C:\Windows\System32

IF

Description: Performs conditional processing in batch programs.

Example: IF EXIST file.txt ECHO File exists

FOR

Description: Loops through a set of files or values.

Example: FOR %%i IN (file1 file2) DO ECHO %%i


GOTO

Description: Directs the command interpreter to a labeled line in the batch program.

Example: GOTO END

:END

ECHO Script Ended

CALL

Description: Calls another batch file and returns to the current file.

Example: CALL otherfile.bat

START

Description: Starts a separate window to run a specified program or command.

Example: START notepad.exe

EXIT

Description: Exits the command interpreter.

Example: EXIT

TITLE

Description: Sets the title for the command prompt window.

Example: TITLE My Batch Script

COLOR

Description: Changes the console's foreground and background colors.

Example: COLOR 0A

CHDIR (CD)

Description: Displays the current directory or changes directories.

Example: CD \path\to\directory
DEL (ERASE)

Description: Deletes one or more files.

Example: DEL file.txt

COPY

Description: Copies one or more files to another location.

Example: COPY file.txt C:\backup\

XCOPY

Description: Copies files and directory trees.

Example: XCOPY source destination /E

MOVE

Description: Moves files and renames files or directories.

Example: MOVE file.txt C:\newfolder\

MKDIR (MD)

Description: Creates a new directory.

Example: MD newfolder

RMDIR (RD)

Description: Removes a directory.

Example: RMDIR foldername

You might also like