Reference:
How to use this Batch Reference Session

Reference
Using this page

 
Terms in or and symbols, all show more details on demand:

You'll find this Reference in our Batch Course, too

Reference
Session index

In this Batch file Reference Session:

For more than Reference try our tutorials instead

 Tutorials  Our free Batch Course (which has this Reference built in) teaches the syntax of Batch files thoroughly in 21 interactive Lessons. For fully-annotated example Batch files, see our Batch Library. Also see our Batch Troubleshooting tips.


Alphabetical List:
Before you read on

Alphabetical
Using this page

 
Don't forget that you can see extra information on demand:

Useful syntax examples

Batch commands have built-in help, for example: xcopy /? | more (the to allows you to read one screenful at a time). However, this doesn't have many syntax examples, so we supplement it with our Course Reference, which does.

Alphabetical Reference in List Box format

Alphabetical
List Box

Our Course Reference is in alphabetical List Box format at the top of this Session, and again here below. Use the alphabetical List Box when you know what commands you want to read about (otherwise see commands arranged in Functional Groups).

Choose and click

Choose a command or term from our Course Reference List Box, and click to read more.

 Remember  Our Course Reference supplements /? help, it doesn't replace it.

This is an InfoBox. We use it to include incidental extra details, or reminders. An InfoBox works like a dynamic footnote you call up with your mouse. The details don't intrude into the main text, but are easily consulted. Your cue to find them is either a or a term in purple text. All these InfoBox notes are built into the page, so they work online or offline. We use a distinctive, bold purple cue for InfoBox information where it's more appropriate than the symbol. Either way, you'll know there are more details you can read whenever you want, simply by hovering your mouse over it. We normally gloss every occurrence of a term (except where it's in the left-margin side headings or a LookUp box) Each instance of the symbol will often disclose different information (where it's appropriate). The same term in purple always shows the same information, wherever on the page you find it (and we normally gloss every occurrence of a term, except where it's in the left-margin side headings or a LookUp box). The same LookUp box window will be used by any clickable item on this page. More mouse clicks won't open extra windows, so you needn't bother to close a LookUp window yourself. When you leave this Session, any LookUp window you still have open will close. MS-DOS (=the MicroSoft Disk Operating System) included Batch processing from version 1.0 (August 1981). It was added to help IBM engineers run long lists of commands to test MS-DOS on the IBM Personal Computer original prototype. The Batch language developed steadily through later versions of MS-DOS, and is always installed in Windows 95, 98, and ME (but many users don't know this).
 NT/2000/XP  An enhanced version of the MS-DOS Batch Language comes with Windows NT/2000/XP.
Each MS-DOS window, or DVM (Dos Virtual Machine), is a shortcut to the file COMMAND.COM, which runs MS-DOS commands (this file contains the Batch processing code, as well). A DVM also relies on the files WINOA386.MOD and VGAFULL.3GR, plus a special hardware mode of your CPU, called V86 (=Virtual 86 mode, the "86" relates to a simpler precursor of the Pentium). Each DVM window is like a small PC, simulated inside your main PC. There's more to an MS-DOS window than there first seems!
 NT/2000/XP  The normal command processor is CMD.EXE (a 32-bit program that doesn't need or use V86 mode).
A Windows 95/98/ME DVM (short for Dos Virtual Machine, also called an MS-DOS window) is a Shortcut to the command processor (COMMAND.COM). It also uses the files WINOA386.MOD and VGAFULL.3GR, together with a hardware mode of your CPU, called V86 (=Virtual 86 mode, the "86" relates to a simpler precursor of the Pentium). A DVM is a PC simulated inside your PC!
 NT/2000/XP  A CMD.EXE window is a 32-bit process. It doesn't use V86 mode.
Options that you add to command-lines are known as switches. Switches are commonly indicated by the  /  (forward slash) character, but sometimes you'll find that a  -  is used instead, as for example in: ftp -help (displays help). A command-line prompt, which looks like this:  , waits for you to type a new command. A command typed at the prompt executes as soon as you press the  Return  key. When several windows are open, only one has focus (it has a standard dark blue Title bar). The window with focus is the one that receives any keystrokes from your keyboard. You give a window focus by clicking on it with the mouse (or clicking its Taskbar button). You can also use  Alt Tab  to put up a menu that will cycle the focus through all windows. Our Batch Reference is built into our pages so it works both offline and online. Every time a Batch command or term (in dark blue) occurs in the text, you can click on it to see a pop-up box with details and examples. This same fast LookUp feature applies throughout each Lesson in our MS-DOS Batch Course. Clicking a Batch command or technical term directly in this way shows the same information as using the Course Reference pull-down List Box. In our Lessons, the Course Reference grows more detailed as you progress through the Course (to avoid too much detail too early). This Reference Session uses the full Course Reference (which appears in the Course at Lesson 20). The path is where to find a file or folder on a disk or network. Always "quote" a path used with Batch commands if it contains  Space s. Windows uses the backslash  \  separator in paths (the forward slash  /  is used for switches). Don't confuse this sense of path as a pointer to a file or folder with the PATH command or PATH environment variable (which holds the list of paths that are searched for executable files). If you're not sure how to type the pipe | operator, use  Alt + 1   2   4  (digits on the Number keypad), or see Lesson 16 of our Batch Course for details of how to code and use pipes. In Windows 95/98/ME, the command processor is COMMAND.COM. It runs MS-DOS commands, and it contains the code to process your Batch commands.
 NT/2000/XP  The command processor to use is CMD.EXE. This also contains the Batch processing code, which has been enhanced (that's why its Batch syntax differs from Windows 95/98/ME).
CMD.EXE is the standard command processor for Windows NT/2000/XP. It's in the Windows\SYSTEM32 folder. In CMD.EXE, the usual Batch commands have the same names as in Windows 95/98/ME, but they have more features. Their syntax can be different, as a result. We indicate some of the differences to expect (watch for  NT/2000/XP  flash). The GUI or Graphical User Interface is shorthand for the Windows interface with all its windows, icons, mouse, and point-and-click way of working. The alternative is a CLI or Command Line Interface (commands typed at a prompt), which is the usual interface for working with Batch files. Batch files can also be run by clicking on them (see Lesson 19 of our Batch Course for how to write Batch files to run properly in the GUI). UNC=Universal Naming Convention: a way to specify a folder on a file server. UNC names are file names (or other resource names) that begin with the string \\, which indicates that they are located on a remote computer. With UNC names for files or folders, Batch commands will work across networks.  Note  Windows needs a backslash  \  separator in its UNC paths (the  /  is reserved for switches). Always "quote" a UNC path if it contains  Space s. Grouping Batch commands by function in this way helps you in selecting which command to use. Each command is clickable to read more details and see syntax examples in its LookUp box. If you also install the file QBASIC.HLP from your CD-ROM, you will be able to get very detailed help in writing QBASIC programs. With all the files installed, you can start the QBASIC program system by typing qbasic at the prompt. If Explorer fully covers the MS-DOS window, hover the mouse briefly over the MS-DOS window's TaskBar button while you drag-and-drop (don't release the mouse button while you hover). The MS-DOS window will pop into focus again, and you'll be able to drop the file on to it. If you are uncertain how to cut-and-paste from an MS-DOS window, see Lesson 19, Exercise 47 of our Batch Course. This Exercise talks you through as you do a cut-and-paste example yourself. Note that start is an internal command in Windows  NT/2000/XP , and it has many extra switches available. The ping command sends a test packet to a remote server to see if it's operating. Some servers reject pings for security reasons, however. The -n switch of ping allows time delays in Batch files. For help with ping, use ping -?. In the Hitch Hiker's Guide to the Galaxy (1979 Douglas Adams), Ford Prefect's entire Guide entry for the planet Earth consisted of a single word: harmless. After fifteen years further hard work, Ford was about to expand the Earth's Guide entry to read: mostly harmless, when the entire planet was wiped out in error by the Vogon Constructor fleet. However, pinging the Local Host remains a fully harmless technique (equivalent to asking your machine if it's still switched on). In Windows NT/2000/XP, use the /? help switch to read more about the Batch commands you think you know. There are full details of the new features and lots of useful syntax examples. Try: call /?, for /?, if /?, set /?, and cmd /?, too, and read how much has been added to the Batch Language. We often use file names that begin with  _  (an underscore character) for our transient work files, to keep them distinct from any normal data files. In practice, it's usually better to create transient files in the TEMP folder, too. A Flagfile is a file that's created to flag (indicate) that some condition is true or some event has occurred. The contents don't usually matter: all that matters is whether it exists or not. It can be a zero-byte file (so it has only a directory entry). If transient (used only briefly), such files are best created in the TEMP folder to avoid cluttering data folders. A hard-coded item is coded as a literal. So a batch file that ran a DIR command on C:\WORK would be said to have C:\WORK hard-coded into it. A batch file that ran a DIR command on whatever folder was passed in, say, %1 is more flexible for many purposes.


Functional groups:
Before you read on

By Function
Using this page

 
Don't forget that you can see extra information on demand:

Find your command and click on it to read more

By Function
Clickable

The Batch commands/terms that we cover are here by function. As usual, each term in is for more details and syntax examples (see our List Box if you already know the command you want):

 Remember  Our Course Reference supplements the /? help, it doesn't replace it.

Batch commands fall into two main types

Batch commands are either (coded within or ) or (each coded in a program file of its own). We use upper case for commands, such as , and lower case for commands, such as . This is our convention, isn't case-sensitive for command names.

Many commands return s a Batch file can test. In Windows 95/98/ME, commands do not return s.


Delays and waits:
Before you read on

Delays / waits
Using this page

 
Don't forget that you can see extra information on demand:

Delays and waiting for external events

Delays / waits
Fixed-time
Process wait
Event wait

We look at three situations:

Fixed-time: Pause a Batch file for a fixed time, say 10 seconds, or an hour
Process wait: A Batch file runs a process, and waits for it to finish
Event wait: A Batch file controls several others, and needs to wait for them to finish


1 Fixed-time delays:
Pausing for a set time

Delays / waits
Fixed-time
with choice
with ping

 
It's often convenient to pause execution of a Batch file for a fixed time, then continue. You can't use the command because it waits until the user presses a key. However, you can pause a batch file for a fixed time with choice or with ping .


1.1 Fixed-time delays:
With command

Delays / waits
Fixed-time
with choice

 
A common way to insert a fixed-time delay of 1–99 seconds is by using . This can be used in Windows 95/98/ME. In you may need to install the command (if you click there's a download link at item (e) - but see the delay method, too, before you decide to download).

Using for delays from 1–99 seconds

For Windows 95/98/ME, and a delay of, say 10 seconds, you can use:

REM | choice /c:delay /td,10>NUL

In , works differently, so use a instead:

TYPE NUL | choice /c:delay /td,10 >NUL

 Note  There is a  Space  before the to , shown highlighted. A digit placed just before the operator in may conflict with of and (which uses the syntax 1> and 2> respectively). This second version also works in Windows 95/98/ME, so can be used for both Operating systems.

Our Batch Course explains this method

In either case, replace the 10 with any number from 199 for other delays (in seconds). Our Batch Course Lesson 10 (more in Lesson 20) explains the method in detail.

Interruption to delay by  Ctrl C 

Delays / waits
Fixed-time
with choice
  trap Ctrl-C

In Windows 95/98/ME, a user can interrupt a delay with  Ctrl C  to frustrate it. However, a batch file can check whether or not it was interrupted. The command:

TYPE NUL | choice /c:delay /td,10 >NUL

returns 1 if the delay completes, because the /td,10 switch supplies a 10-second timeout reply of d, the 1st in the c:delay reply list (the other replies, elay, aren't used: they're added simply to document the command).

However, if the user cuts the delay by pressing  Ctrl C  and answering  N  (to the usual Terminate batch job (Y/N)? question) the command returns 0.

Batch file traps  Ctrl C  delay interruption

Delays / waits
Fixed-time
with choice
  trap Ctrl-C
    example

The following example shows the syntax to detect a user shortening the delay with  Ctrl C  then answering  N  (which resumes the batch job).

@ECHO OFF
:: Delay for 10 seconds
TYPE NUL | choice /c:delay /td,10 >NUL
IF ERRORLEVEL 1 ECHO. Delay successful
IF NOT ERRORLEVEL 1 ECHO. Interrupted by Crtl-C

The example in use

C:\CSW>delaydemo.bat
 Delay successful
C:\CSW>delaydemo.bat
  (user presses  Ctrl C  then  N )
Terminate batch job (Y/N)?n
 Interrupted by Crtl-C
C:\CSW>_

Use the test to take appropriate action if a delay is interrupted.

Our Batch Course has much more detail

If you're uncertain about how to use , or the test, or the right order in which to test s, take our Batch Course for a thorough treatment.


1.2 Fixed-time delays:
Before you read on

Delays / waits
Using this page

 
Don't forget that you can see extra information on demand:

Fixed-time delays with the ping command

Delays / waits
Fixed-time
with ping

The command is part of the standard Microsoft TCP/IP setup, and so it's available on all Windows internet-enabled PCs. sends a diagnostic request to a remote server and waits for an echo. It has a to set the number of requests to send.

For example, to send 11 requests, use: ping -n 11 (and add the destination server).

sends the first request immediately. When it gets a reply, or times out (because the remote server doesn't reply), it waits one second and then sends the next request.

Sending requests to your own machine

Your own machine (Local Host) has the TCP/IP address 127.0.0.1 (by convention) and it always replies to a request immediately. So, for example, you can do this:

ping -n 11 127.0.0.1

sends the first request and it gets a reply immediately. waits one second, sends the next request, gets an immediate reply, and so on – for the ten requests after the first. So to the Local Host those 11 times takes exactly 10 seconds.

You needn't be online to ping yourself

You can yourself (127.0.0.1) offline; and like the planet Earth, it's harmless. And there's no limit to the COUNT in ping -n COUNT, so it allows long time delays, too.

If we add a to to suppress the reports, the command is complete:

Delays / waits
Fixed-time
with ping
  examples

:: Insert delay of 10=11-1 seconds
ping -n 11 127.0.0.1 >NUL

:: Insert delay of an hour=3601-1 seconds
ping -n 3601 127.0.0.1 >NUL

 Note  The  Space  before the >NUL avoids any conflict with of and which uses the syntax 1> and 2> respectively.

Ping delays use very little CPU time

Unlike delays, which are processor intensive and may slow other programs, a delay uses little CPU (Central Processor Unit) time (typically less than 0.5%).

Interruption to ping delay by  Ctrl C 

Delays / waits
Fixed-time
with ping
  trap Ctrl-C

A user can interrupt a delay with  Ctrl C  to frustrate it. However, a batch file can check whether or not it was interrupted. The command:

ping -n 601 127.0.0.1 >NUL

returns 0 when the 10 minute=(601-1 seconds) delay finishes.

However, if the user cuts the delay by pressing  Ctrl C  (and resumes by answering  N  to any Terminate batch job (Y/N)? question) the command returns:

By testing for exact 0, a batch file can check whether or not a delay was cut short with  Ctrl C .

Batch file traps  Ctrl C  delay interruption

Delays / waits
Fixed-time
with ping
  trap Ctrl-C
    example

The following example shows the syntax to detect a user shortening the delay with  Ctrl C  (then answering any Terminate question  N , to resume batch job).

@ECHO OFF
:: Insert delay of 10 minutes=601-1 seconds
ping -n 601 127.0.0.1 >NUL
:: Test for exact ERRORLEVEL 0
IF ERRORLEVEL 0 IF NOT ERRORLEVEL 1 GOTO RESUME
ECHO. Interrupted with Ctrl-C

:RESUME

Use the test to take appropriate action when a delay is interrupted.

Our Batch Course has much more detail

If you're uncertain about how to use the test, or the right order in which to test s, take our Batch Course for a thorough treatment.


2: Wait for a process
Before you read on

Delays / waits
Using this page

 
Don't forget that you can see extra information on demand:

With command

Delays / waits
Process wait
with start

When a Batch file executes a program, Windows runs it as a separate process in parallel with the Batch file. The Batch file continues with the next line of code, before the program finishes. If the Batch file needs the result of the program, it must wait. Instead of (guessing) a fixed delay, you can use the command.

/wait waits and returns s

The /wait pauses a Batch file until a ed program finishes. What's more, if you run a program with /wait, the command will return any (from the program) to your Batch file. To see a list of that supports, use start /? (in Windows  has extra features).

Example: start /wait GUIprogram.exe /switch Par1 Par2

 Note 1  You can add and parameters for the program (if it uses them). Separate each with a  Space  as shown or won't handle it correctly.

 Note 2  The /wait switch can usually be abbreviated to /w.

Windows NT/2000/XP with "quoted" path

Delays / waits
Process wait
with start

If the program has a long with  Space s, you'll need to "quote" it. But in Windows , treats the first quoted parameter as a window title, so you need a quoted string before any quoted (it can be an empty " " dummy string).

start /wait "" "C:\Program Files\Program.exe" /switch Par1 Par2

Windows 95/98/ME with "quoted" path

Again, if the program has a long with  Space s, you'll need to "quote" it. The Windows 95/98/ME command doesn't accept a window title, so don't use one.

start /wait "C:\Program Files\Program.exe" /switch Par1 Par2


Cross-platform tweak:
Handle "quoted" path

Delays / waits
Process wait
with start
  quote tweak

 
The same quoted command can work in both Windows  and Windows 95/98/ME, with a special tweak. This is a command to a title string only in Windows  (but does nothing in Windows 95/98/ME).

A need not be at the end of a line

In Windows 95/98/ME, the statement:

ECHO/>NUL&SET TITLE="" that's just a pair of empty "double-quotes".

simply s the string &SET TITLE="" to . It's a peculiarity of that the >NUL applies to the whole line, even when it isn't at the end of the command. The use of ECHO/ has fewer side effects than other suffix characters, so we use it in special situations instead of ECHO. (click for details of all suffix characters).

In Windows NT/2000/XP there are two commands

In Windows ,  &  separates commands, so sees two of them:

ECHO/>NUL and the  & -separated SET TITLE=""

The ECHO/>NUL simply s a carriage return and linefeed to , and the statement is executed, loading the window title in the variable TITLE. As a result, the TITLE variable is to a window title only in Windows .

Putting this together in a Batch file fragment

Delays / waits
Process wait
with start
  quote tweak
    example

As a result, the syntax below works for both Windows 95/98/ME and :

:: Clear TITLE variable
SET TITLE=
:: Set TITLE to "" only in Windows NT/2000/XP
ECHO/>NUL&SET TITLE=""
:: Cross-platform start with "quoted" path
start /wait %TITLE% "C:\Program Files\Program.exe"

 Note 1  SET TITLE= (without a value) ensures TITLE is clear in Windows 95/98/ME.

 Note 2  In the line, ECHO/>NUL&SET TITLE="", you can a proper window title instead of the blank "" if you prefer (making its Taskbar button easier to identify).

 Note 3  In the line, we expand the TITLE variable. In Windows 95/98/ME it expands to nothing, but in Windows  it expands to a pair of "quotes". If you're uncertain about expanding variables, see Lesson 1 of our Batch Course.


Practical example:
Using UltraEdit

Delays / waits
Process wait
with start
  example

 
The Hex Editor UltraEdit can be run from a Batch file. Here, we it with a command line that runs a Macro (edit.mac) 100 times and Exits when finished:

Waiting for a complex hex edit to complete

@ECHO OFF
:: Run UltraEdit macro 100 times on FILE.BIN
start /wait UEDIT32.EXE FILE.BIN /M,E,100="edit.mac"

:: Execution resumes only when UltraEdit finishes
:: so next command can safely use the edited file
COPY /y FILE.BIN C:\EditedData\FILE.DAT

Batch file waits until external edit complete

The macro repetition may well take several seconds, so the Batch file must wait before ing the resulting file. The /wait ensures that it does. The command looks up the UltraEdit in the Windows registry (in the App paths key), so there is no need for a quoted "Program Files" in this case.

Some multi-threaded programs don't /wait

Some programs are multi-threaded: they spawn child processes (threads). It's possible that the /wait command may resume before all threads of this type of program are finished. In those (and other) cases, a Batch file can wait for an event.


3: Wait for an event:
Before you read on

Delays / waits
Using this page

 
Don't forget that you can see extra information on demand:

Big projects are best split into many files

Delays / waits
Event wait

A large Batch project is best split between a number of Batch files, in a hierarchy with one Master Batch file in control of the others. It's the others that do all the actual work.

With the Master file loses control

The Master Batch file could each of the other batch files in turn, but this puts each ed file in control. The Master file must wait until each ed file finishes before ing the next. If one of the other batch files hangs, everything stops from that point.

Master file s job and waits for events

To stay in control, the Master Batch file s the others (without the /wait switch, or it would be waiting as it does with ). The other files now run in parallel, while the Master file checks for specific events in the other files, and reports on any problems. A common event is that one of the other files has finished.

Waiting for an event
– the theory

Delays / waits
Event wait
  theory

Suppose a Master Batch file has ed another batch file (OtherBatch.bat), and needs to wait until it's finished before some other task can be run. The solution is:

When Master.bat finds that _FLAG.TMP exists, it can get on with other tasks that depend on the results of OtherBatch.bat. It doesn't matter what's in _FLAG.TMP: the file is either there (=sub-task finished) or it's not (=sub-task not yet finished).

 Note  Transient files such as _FLAG.TMP are best created in the folder, but for this discussion, we'll ignore that refinement. If you're unfamiliar with this folder, click. For more on using the folder, see Lesson 7 of our Batch Course.

Waiting for an event
– the practice

Delays / waits
Event wait
  practice

Many things can go wrong in practice. Consider some problems (and their solutions):

 Note  See Lesson 12 of our Batch Course for how to use command-line parameters.

An example with those problems handled

Delays / waits
Event wait
  example

Here is a pair of example Batch files coded with those solutions. The superscripts show where the problems numbered 1–4 above are handled.

Master.bat code:

@ECHO OFF
:: Ensure Flagfile doesn't exist1
IF EXIST _FLAG.TMP DEL _FLAG.TMP

:: START OtherBatch, passing Flagfile name2,4
start /min OtherBatch.bat _FLAG1.TMP

:: Allow OtherBatch 60=(61-1) secs to finish3
ping -n 61 127.0.0.1 >NUL
:: Check for Flagfile
IF EXIST _FLAG1.TMP GOTO TASKDONE
:: No Flagfile - we have a problem
ECHO. Problem in OtherBatch! Continuing...
GOTO RESUME

:TASKDONE
:: OtherBatch.bat signals done, DEL Flagfile
DEL _FLAG1.TMP
ECHO. OtherBatch.bat done. Continuing task...

:RESUME
:: Rest of Master task goes here

Notes correspond to problem numbers above

1 Make sure doesn't exist already
2 Use name specific to OtherBatch.bat, 4and pass as command line parameter
3 Wait long enough, then assume a problem in OtherBatch.bat

OtherBatch is given the Flagfile name to use

Delays / waits
Event wait
  example

OtherBatch.bat is written to receive its name as a command-line parameter. It tests that it has received a parameter, and that it isn't the name of an existing file.

OtherBatch.bat code:

@ECHO OFF
:: Check Flagfile name was passed
IF [%1]==[] GOTO E_FLAG
:: Check Flagfile doesn't exist yet
IF EXIST %1 GOTO E_FLAG

:: Code for task of OtherBatch.Bat goes here
:: (simulate a task with 30 secs PING delay)
ping -n 31 127.0.0.1 >NUL

:: Create Zero-Byte file using Par1 name4
:: we were passed to signal we're done
TYPE NUL>%1

:: CLS+EXIT to close window and finish
CLS
EXIT

:E_FLAG
ECHO. Flagfile name not passed or Flagfile
ECHO. already exists! Bailing out now with
ECHO. no further work on the current task.

Note corresponds to problem number

4 Use name passed in command-line parameter %1, so that the name isn't into OtherBatch.bat. Passing data as parameters makes it easier to edit and maintain a suite of batch files.

 Note  See Lesson 12 of our Batch Course for how to use command-line parameters.


Short names
Using this page

Short-form names:
Before you read on

 
Don't forget that you can see extra information on demand:

Finding the full short-form name of a file

Short names
Drag-and-drop

When you want the full (short name) to a file in nested long-named folders, such as: C:\Program Files\TextPad 4\TextPad.exe (executable file for TextPad):

  1. Open an
  2. In the , type:  Space  (but don't press  Return )
  3. Open Windows Explorer and locate the file TextPad.exe
  4. Left-click-hold TextPad.exe, drag-and-drop it on to the
  5. The
  6. will have a ark showing the full short-form :

With the file won't be executed by accident

C:\CSW>REM C:\PROGRA~1\TEXTPA~1\TEXTPAD.EXE

C:\CSW>_

 Note  You can also use this method with a folder to find its name, say to use as a . Just drag-and-drop the folder from Explorer on to the as before.

Avoid mistakes with mark-copy-and-paste

Copy the short-form to a file using the window buttons: Mark, Copy, and Paste buttons


Network paths:
Before you read on

Network paths
Using this page

 
Don't forget that you can see extra information on demand:

Drag-and-drop method works across networks

Network paths
Drag-and-drop

Drag-and-drop will find network to remote files. Locate the remote file in Explorer (Network Neighborhood), and drag-and-drop it on an (using a ark+ Space  to prevent accidental execution of the file), like this:

  1. Open an
  2. In the , type:  Space  (but don't press  Return )
  3. Open Windows Explorer and locate the file or folder in Network Neighborhood
  4. Left-click-hold the file or folder, drag-and-drop it on to the
  5. The
  6. will have a ark showing the network

Avoid mistakes with mark-copy-and-paste

Copy the network to a file using the window buttons: Mark, Copy, and Paste buttons

Typical example of UNC name used with

Suppose a remote machine's network name is OTHER, and its C: drive is mapped to C (which is normal). The example below uses the /L=(List only) and /D=DateSensitive) of . The command lists all files in the C:\DATA folder (and subfolders) on the remote machine that are more up-to-date than (or don't exist on) the local machine.

Using to check files across a network

Network paths
example

C:\CSW>xcopy \\OTHER\C\DATA\*.* C:\DATA\*.* /L /S /D /Y
  ... list of files more up-to-date on the remote
  ... machine than their same-name versions found
  ... locally and those that do not exist locally
C:\CSW>_

Updating changed files across a network

Without the /L=(List only) , the example above would update the local files by copying any new or changed versions from the remote machine; files that haven't changed aren't copied. For more details of how works, use: xcopy /? | more at the , and click anywhere in this Session or in our Batch Course.

 Remember  Our Course Reference supplements the /? help, it doesn't replace it. In xcopy /? | more the to lets you read /? help one screenful at a time.


Batch documentation:
Before you read on

Comments
Using this page

 
Don't forget that you can see extra information on demand:

The most useful (but underused) commands

Comments
REM and ::

You can put s in Batch files: these are ignored when your Batch files run.

We our Batch files extensively (see examples in our Batch Library). We find it saves time when later changing them. You can read the difference between the two introducers by clicking on or (double-colon, most often used).

s used in immediate mode

Most Batch commands can be used at the : this is called immediate mode. If you type a at the , nothing happens:

C:\CSW>REM A REM(ark) does nothing

C:\CSW>:: Normal way to comment

C:\CSW>_

For an example using in immediate mode, see how to find short-form .


On-screen help:
Before you read on

 /? built-in help
Using this page

 
Don't forget that you can see extra information on demand:

Getting help with /?

 /? built-in help
Quick to use

Most commands respond to a /? help . You'll often answer questions quickly with /? help at the in an (in our Batch Course you'll learn to configure an that's ideal for Batch work):

C:\CSW>md /?
Creates a directory.

MKDIR [drive:]path
MD [drive:]path

C:\CSW>cls /?
Clears the screen.

CLS

C:\CSW>_

/? is quick and easy and there's often

Here at Allenware.com, we still use /? help to check some command syntax details, because it's quick, easy, and it's always right there at the when you need it. If you find that /? help scrolls off screen before you can read it all, use a to to read one screenful at a time. For example: xcopy /? | more


MS-DOS version 6.22:
Before you read on

Ver 6.22 help
Using this page

 
Remember, hover your mouse over any , or any term to see an .

Extensive help system

Ver 6.22 help
Installation

The Windows 95/98/ME CD-ROM includes the old version 6.22 help system. This consists of three files: HELP.COM, HELP.HLP, QBASIC.EXE (usually in a subfolder called OLDMSDOS or similar). To install this help system, locate these three files on the CD-ROM and copy them to your C:\WINDOWS\COMMAND folder.

Once the files are copied, you can use the 6.22 help system. Just type help  Space  followed by the command name for help with a specific command, or type help on its own to see the full help index.

The 6.22 help system is very extensive, and although some of it no longer applies in Windows 95/98/ME, much remains useful. To close 6.22 help, press  Alt-F   X .

Further questions:
You can

Any questions

 
If you have questions or comments about this Reference Session, please (your email subject line should contain: Allenware.com website). Please be sure to say whether you are using Windows 95/98/ME or Windows NT/2000/XP.

William Allen and Linda Allen
© Copyright 2003- Allen & Company. All rights reserved ©