text
stringlengths
0
4.23k
Examples
To display the current echo setting, type:
echo
To echo a blank line on the screen, type:
echo.
Note
Don't include a space before the period. Otherwise, the period appears instead of a blank line.
To prevent echoing commands at the command prompt, type:
echo off
Note
When echo is turned off, the command prompt doesn't appear in the Command Prompt window. To display the command prompt again, type echo on.
To prevent all commands in a batch file (including the echo off command) from displaying on the screen, on the first line of the batch file type:
@echo off
You can use the echo command as part of an if statement. For example, to search the current directory for any file with the .rpt file name extension, and to echo a message if such a file is found, type:
if exist *.rpt echo The report has arrived.
The following batch file searches the current directory for files with the .txt file name extension, and displays a message indicating the results of the search:
@echo off
if not exist *.txt (
echo This directory contains no text files.
) else (
echo This directory contains the following text files:
echo.
dir /b *.txt
)
If no .txt files are found when the batch file is run, the following message displays:
This directory contains no text files.
If .txt files are found when the batch file is run the following output displays (for this example, assume the files File1.txt, File2.txt, and File3.txt exist):
This directory contains the following text files:
File1.txt
File2.txt
File3.txt
edit
Starts the MS-DOS Editor, which creates and changes ASCII text files.
Syntax
edit [/b] [/h] [/r] [/s] [/<nnn>] [[<drive>:][<path>]<filename> [<filename2> [...]]
Parameters
Parameter
Description
[<drive>:][<path>]<filename> [<filename2> [...]]
Specifies the location and name of one or more ASCII text files. If the file doens't exist, MS-DOS Editor creates it. If the file exists, MS-DOS Editor opens it and displays its contents on the screen. The filename option can contain wildcard characters (* and ?). Separate multiple file names with spaces.
/b
Forces monochrome mode, so that MS-DOS Editor displays in black and white.
/h
Displays the maximum number of lines possible for the current monitor.
/r
Loads file(s) in read-only mode.
/s
Forces the use of short filenames.
<nnn>
Loads binary file(s), wrapping lines to nnn characters wide.
/?
Displays help at the command prompt.
[<drive>:][<path>]<filename> [<filename2> [...]]
<nnn>
Remarks
For additional help, open MS-DOS Editor, and then press the F1 key.
Some monitors don't support the display of shortcut keys by default. If your monitor doesn't display shortcut keys, use /b.
Examples
To open MS-DOS Editor, type:
edit
To create and edit a file named newtextfile.txt in the current directory, type:
edit newtextfile.txt
end restore
Ends a restore session and issues a PostRestore event to involved writers.
Syntax
end restore
endlocal
Ends localization of environment changes in a batch file, and restores environment variables to their values before the corresponding setlocal command was run.
Syntax
endlocal