December 22, 2024

Command:

Usage:

Notes:

Call

Call {batch file}:{subroutine}

Call batch.bat %a%

Echo

Echo {string}

Echo Hello World

For

For %a in (list) do command [ parameters ]

For %a in (a.txt b.txt) do type %a

Goto

Goto {location}

Goto end
:end

If

If [not] errorlevel number command
If [not] string1==string2 command
If [not] exist filename command

If
“%1″==”/?” goto help

Pause

Pause

Prints Press any key to continue…

Rem

Rem Comments

 

Set

Set {label} = {value}

Set msg=hello
Echo %msg%

Shift

Shift

:Loop
If “%1″==”” Goto continue
Type %1
Shift
Goto Loop

@

@command

Suppresses command display
@echo off

Links:
DOS Batch Language
Google
FAQ at Batfile (Huge!)
Eric Phelps
Command Reference
WindowsShellScripting
NT Command Shell – Microsoft
Rob van der Woude
Tom Lavedas’ Batch File Applications
DOS FAQ
More Links