Multiple Commands

Print Topic  Return to Overview  Previous Topic  Next Topic 

You will often know the next two or three commands that you want to execute. Instead of waiting for each one to finish before you type the next, you can type them all on the same command line, separated by the command separator (by default, an ampersand &) or the %+ pseudovariable. For example, if you know you want to copy all of your .TXT files to D:\TEXT and then delete all of them beginning with 'A', you could enter the following command:

 

copy *.txt d:\text\ & del a*.txt

 

You may put as many commands on the command line as you wish, as long as the total length of the command line does not exceed 32,767 characters before alias and variable expansion, and 65,535 characters after expansion.

 

You can use multiple commands in alias definitions and batch files as well as from the command line.

 

If you don't like using the default command separator, you can pick another character using the SETDOS command's /C option, or the Separator character configuration option.

 

Topic "multcmds.htm" last edited 1/28/2008. ©2008  JP Software, Inc.
Keywords: Multiple Commands,CommandSep,Compound Character