×
Menu
Index

Examples

 
Add or delete a line in an existing text file
 
The SET TEXTLINE command can be used to add or delete a line in an existing text file, or even to create a text file containing a specified line of text. The following are some examples of usage:
 
SET TEXTLINE file.txt "line 1"
create file.txt, add "line 1" as the first line
SET TEXTLINE file.txt "line 2"
add "line 2" at end of file.txt
SET TEXTLINE file.txt "line 2" /a
same as above
SET TEXTLINE file.txt "line 0" /b
add "line 0" at beginning of file.txt
SET TEXTLINE file.txt "line 1a" /a "line 1"
add "line 1a" after "line 1"
SET TEXTLINE file.txt "line 1b" /b "line 2"
add "line 1b" before "line 2"
SET TEXTLINE file.txt "line 2" /d
delete "line 2"
SET TEXTLINE file.txt "last line"
add "last line" at end of file
SET TEXTLINE file.txt "las*" /d
delete line starting with "las" (as in "last line")
 
Extract one or more files from a cab file
 
The EXTRACT (or COPY CAB) command can extract one or more files from a cab file. This command can be useful in conjunction with the COPY INF command if the driver files (inf, sys, cat) are available only within a cab file, rather than as separate files.
 
EXTRACT file.cab file.inf c:\thisdir
extract file.inf from file.cab and place in c:\thisdir
EXTRACT file.cab file.inf .
extract file.inf from file.cab and place in current directory (note the period as the targetdir parameter)
 
Basic examples commands
 
The remainder of the commands work the same as (or very similar to) their operating system equivalents. Following are some basic examples of usage:
 
DIR
list contents of current directory
DIR *.txt
list all files with a .txt extension in current directory
PWD
display the current working directory
COPY FILE filename a:
copy filename to drive a:
COPY c:\test\* c:\test2 /s
copy contents of  folder c:\test and all sub folders to c:\test2
MD newdirectory
create a directory named  newdirectory in current directory
REN FILE filename newfilename
rename filename to newfilename
REN FILE *.txt *.doc
change all .txt extensions to .doc extensions
DEL FILE filename /y
delete filename, and do not confirm the deletion