Beruflich Dokumente
Kultur Dokumente
A command capability within DOS at all times, such as Dir, Copy, Del, Ren, Type and Cls. The internal
commands are part of DOS' COMMAND.COM file. If you delete COMMAND.COM, you can no longer
command DOS to do anything at the command line.
The other kind of commands DOS can execute are external commands. Each external command, such as
Format, Xcopy and Backup, resides in its own file in the DOS directory. If any of those files are deleted
accidentally or purposefully, you can still execute all of DOS' internal commands and any external
commands that are still left on disk.
An instruction that DOS and Windows execute from the command line or from a batch file. A variety of internal commands,
such as Dir and Copy, are built into COMMAND.COM, located in the \DOS or \WINDOWS folder. Many external
commands, such as Format and Xcopy, are individual executables that reside in the \DOS or \WINDOWS\COMMAND
folder.
DOS commands are still widely used in Windows by programmers and power users. Quite often, a typed-in command can
perform an operation much faster and much easier than dragging and dropping icons in a GUI interface.
CHDIR COMMAND
About chdir
Chdir (Change Directory) is a command used to switch directories in MS-DOS.
Syntax
CHDIR [drive:][path]
CHDIR[..]
CD [drive:][path]
CD[..]
Examples
chdir\
Goes to the highest level, the of the drive.
chdir..
Goes back one directory. For example, if you are within the C:\Windows\COMMAND> directory, this would
take you to C:\Windows>
Windows 95, Windows 98 and later versions of windows allow you to go back more than one directory by
using three or more dots. For example, typing chdir... with three dots after the cd would take you back
two directories.
cdhdir windows
If present, would take you into the Windows directory. Windows can be substituted with any other name.
CLS COMMAND
About cls
Cls is a command that allows a user to clear the complete contents of the screen and leave only a prompt.
Syntax
CLS
Examples
cls
Running the cls command at the command prompt would clear your screen of all previous text and only
return the .
COPY COMMAND
About copy
Allows the user to copy one or more files to an alternate location.
Syntax
Copies one or more files to another location.
COPY [/A | /B] source [/A | /B] [+ source [/A | /B] [+ ...]] [destination] [/A | /B]] [/V] [/Y | /-Y]
The switch /Y may be preset in the COPYCMD environment variable. This may be overridden with /-Y on
the command line.
To append files, specify a single file for destination, but multiple files for source (using wildcards or
file1+file2+file3 format).
Examples
copy *.* a:
Copy all files in the current directory to the floppy disk drive.
copy autoexec.bat c:\windows
Copy the autoexec.bat, usually found at , and copy it into the windows directory; the autoexec.bat can be
substituted for any file(s).
copy win.ini c:\windows /y
Copy the win.ini file in the current directory to the windows directory. Because this file already exists in
the windows directory it normally would prompt if you wish to overwrite the file. However, with the /y
switch you will not receive any prompt.
copy "computer hope.txt" hope
Copy the file "computer hope.txt" into the hope directory. Whenever dealing with a file or directory with a
space, it must be surrounded with . Otherwise you'll get the " error.
copy myfile1.txt+myfile2.txt
Copy the contents in myfile2.txt and it with the contents in myfile1.txt.
copy con test.txt
Finally, a user can create a file using the copy con command as shown above, which creates the test.txt
file. Once the above command has been typed in, a user could type in whatever he or she wishes. When
you have completed creating the file, you can save and exit the file by pressing CTRL+Z, which would
create ^Z, and then press enter. An easier way to view and edit files in MS-DOS would be to use the .
DATE COMMAND
About date
The date command can be used to look at the current date of the computer as well as change the date to
an alternate date.
Syntax
Displays or sets the date.
DATE [date]
Type DATE without parameters to display the current date setting and
a prompt for a new one. Press ENTER to keep the same date.
Examples
date
Display the current date and prompt for a new one. If no date is entered, the current date will be kept.
DEL COMMAND
About del
is a command used to delete files from the computer.
Windows 2000 and Windows XP syntax
Deletes one or more files.
DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
DIR COMMAND
About dir
The dir command allows you to see the available files in a directory.
Examples
dir
Lists all files and directories in the directory that you are currently in.
dir *.exe
The above command lists any file that ends with the. See the for further wildcard examples.
dir *.txt *.doc
The above is using multiple filespecs to list any files ending with .txt and .doc in one command.
dir /ad
List only the directories in the current directory. If you need to move into one of the directories listed use
the.
dir /s
Lists the files in the directory that you are in and all sub directories after that directory, if you are at root
"C:\>" and type this command this will list to you every file and directory on the C: drive of the computer.
dir /p
If the directory has a lot of files and you cannot read all the files as they scroll by, you can use this
command and it will display all files one page at a time.
dir /w
If you don't need the info on the date / time and other information on the files, you can use this command
to list just the files and directories going horizontally, taking as little as space needed.
dir /s /w /p
This would list all the files and directories in the current directory and the sub directories after that, in
wide format and one page at a time.
dir /on
List the files in alphabetical order by the names of the files.
dir /o-n
List the files in reverse alphabetical order by the names of the files.
dir \ /s |find "i" |more
A nice command to list all directories on the hard drive, one screen page at a time, and see the number of
files in each directory and the amount of space each occupies.
dir > myfile.txt
Takes the output of dir and re-routes it to the file myfile.txt instead of outputting it to the screen.
Syntax
Microsoft Windows 2000, Windows XP, Windows Vista, and Windows 7 syntax
Displays a list of files and subdirectories in a directory.
DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N] [/O[[:]sortorder]] [/P] [/Q] [/S]
[/T[[:]timefield]] [/W] [/X] [/4]
ECHO COMMAND
About echo
Echo is used to repeat the text typed in back to the screen and can be used to echo to a peripheral on the
computer, such as a COM port.
Syntax
Displays messages, or turns command-echoing on or off.
ECHO [ON | OFF]
ECHO [message]
Type ECHO without parameters to display the current echo setting.
Examples
Echo ata > com1
Depending if your modem was on com1, this would make the modem try responding and you should hear
some squealing from the modem. To stop the squealing, just typ echo atz > com1.
Echo echo this is a test > test.bat
This would put in the file test.bat echo this is a test, then when ever you would type in test, it would type
in echo this is a test.
Echo testing the echo string
This would type on your screen, testing the echo string, and then take you back to the prompt.
Microsoft DOS erase command
About erase
Erase is a command used to remove files from your computer's hard disk drive or other writable media.
Syntax
Deletes one or more files.
DEL [drive:][path]filename [/P]
ERASE [drive:][path]filename [/P]
Examples
Erase c:\windows\*.FAK
Delete any files that end with the FAK extension.
Notice: Users will not receive a confirmation prompt when performing this command. Once executed, all
files will be deleted unless the files have a read-only attribute and the /F switch is not being used.
EXIT COMMAND
About exit
The exit command is used to withdrawal from the currently running application and the MS-DOS session.
Syntax
Quits the COMMAND.COM program (command interpreter).
EXIT
Examples
Exit
When in another command interpreter, would exit you out of the new command interpreter
into the original.
If in the recovery console, would exit the and reboot the computer.
The above example creates the "test" directory in the current directory.
mkdir "computer hope"
The above command would create a directory called "computer hope", if you want a space in your
directory name it must be surrounded in quotes.
md c:\test
Create the "test" directory in the c:\ directory.
MOVE COMMAND
About move
Allows you to move files or directories from one folder to another, or from one drive to another.
Syntax
Moves files and renames files and directories.
To move one or more files:
MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination
To rename a directory:
MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2
The switch /Y may be present in the COPYCMD environment variable. This may be overridden with /-Y on
the command line. Default is to prompt on overwrites unless MOVE command is being executed from
within a batch script.
Examples
move c:\windows\temp\*.* c:\temp
Move the files of c:\windows\temp to the temp directory in root, this is of course assuming you have the
windows\temp directory.
move "computer hope" example
If your directory name has a space, it must be surrounded with, otherwise you will get a. error message.
In the above example, this command would move the "computer hope" directory into the example
directory contained in the same directory.
PAUSE COMMAND
About pause
The pause command is used within a computer and allows the computer to pause the currently running
batch file until the user presses any key.
Syntax
Suspends processing of a batch program and displays the message:
Press any key to continue....
PAUSE
Examples
pause
When in a stop the file until you press any key to continue.
RD / RMDIR COMMAND
About rd / rmdir
Removes empty directories in MS-DOS. To delete directories with files or directories within them the user
must use the command, or if you are running Microsoft Windows 2000 or Windows XP use the /S option.
Syntax
Removes (deletes) a directory.
RMDIR [drive:]path
RD [drive:]path
Windows 2000 and Windows XP Syntax.
RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path
Removes all directories and files in the specified directory in addition to the directory itself. Used to remove a direc
/S
Quiet
/Q mode, do not ask if ok to remove a directory tree with /S.
TIME COMMAND
About time
Allows the user to view and edit the computer's time.
Syntax
Displays or sets the system time.
TIME [time]
Type TIME with no parameters to display the current time setting and a prompt
for a new one. Press ENTER to keep the same time.
Examples
time 12:00
Set the time to 12:00
VERIFY COMMAND
About verify
Enables or disables the feature to determine if files have been written properly.
Syntax
Tells Windows whether to verify that your files are written correctly to a disk.
VERIFY [ON | OFF]
Type VERIFY without a parameter to display the current VERIFY setting.
Examples
verify on
Turn verify on.
VOL COMMAND
About vol
Displays the volume information about the designated drive.
Syntax
Displays the disk volume label and serial number, if they exist.
VOL [drive:]
Examples
vol c:
Display the volume of drive c: as shown in the below example.
Volume in drive C has no label.
Volume Serial Number is 1C24-AB20
TIME
Displays current time and allows it to be changed.
Syntax: TIME
DATE
Displays current date and allows it to be changed.
Syntax: DATE
CLS
Clears the screen.
Syntax: CLS
DIR
Shows directory information of a diskette: name, size, and the
date and time stamp of files.
Syntax: DIR [d:][path]
Optional switches:
/p Display dir info and pauses display when the screen is full
/w Display names and extensions only in five columns
To display a file directory listing for D:\LET\ANNUAL
D:\LET\ANNUAL>DIR
(from D:\LET\ANNUAL)
D:\DATA>DIR \LET\ANNUAL
(from D:\DATA)
C:\WINDOWS>DIR D:\LET\ANNUAL
(from C:\WINDOWS)
<="" a="">
COPY
Copies a file. Name of copy may be the same as original, or different.
Syntax: COPY [d:][path][name.ext] [d:][path][name.ext]
Optional switches:
/v Verify, copies the file and compares it with the original
/b Binary file
To copy a file from D:\BATCH to the root of A: drive
A:\>COPY D:\BATCH\CL.BAT
(from A: drive)
D:\BATCH>COPY CL.BAT A:\
(from D:\BATCH)
To copy a file from the root of C: to A: drive and change its name
A:\>COPY C:\MSDOS.SYS MSDOSSYS.BAK
(from A:)
C:\>COPY MSDOS.SYS A:\MSDOSSYS.BAK
(from the root of C:)
To copy all of the files from the root of A: to D:\CCV\ENGCOMP
A:\>COPY *.* D:\CCV\ENGCOMP
(from A:)
D:\CCV\ENGCOMP>COPY *.* A:\
(from D:\CCV\ENGCOMP)
TYPE
Displays the contents of a file.
Syntax: TYPE [d:][path][name.ext]
To display the contents of the file MY.LET to the screen
A:\>TYPE MY.LET
DEL
Deletes a file from disk.
Syntax: DEL [d:][path][name.ext]
To delete one file:
A:\>DEL A:\MY.LET
To del all files in current directory
A:\>DEL *.*
REN
Renames a file.
Syntax: REN [d:][path][name.ext] [d:][path][newname.ext]
To change the name of the file D:\LET\ANNUAL\99.DOC to 1999.DOC
D:\LET>REN ANNUAL\99.DOC 1999.DOC
(from D:\LET)
D:\DATA>REN \LET\ANNUAL\99.DOC 1999.DOC
(from D:\DATA)
C:\WINDOWS>REN D:\LET\ANNUAL\99.DOC 1999.DOC (from C:\WINDOWS)
MD
Makes (creates) a new directory.
Syntax: MD [d:][path][dirname]
To create a directory named HERMIT in the root of D: drive
D:\>MD HERMIT
(from D:\)
C:\>MD D:\HERMIT
(from C:\)
RD
Removes an existing directory
(directory must be empty).
Syntax: RD [d:][path][dirname]
To remove the HERMIT sub-directory
D:\>RD HERMIT
(from D:\)
C:\>RD D:\HERMIT
(from C:\)
CD
Changes the current directory.
Syntax: CD [path][dirname]
To make D:\HERMIT the current directory
D:\>CD HERMIT
(from D:\)
D:\DATA>CD \HERMIT
(from D:\DATA)
D:\DATA\SOURCE>CD \HERMIT
(from D:\DATA\SOURCE)
D:\DATA\SOURCE>CD ..
(from D:\DATA\SOURCE)
PATH
The PATH command is used to help the command interpreter find
external commands which are not in the current directory. The
command interpretter looks into the
DOS environment for "PATH=" and then searches the
paths (each separated from the next by a semicolon) that follow.
Syntax: PATH=[path;path;...]
To set the DOS PATH:
PATH=C:\DOS;C:\PCW;\C:\BIN
To display the current path:
PATH
SET PROMPT
Used to specify the appearance of the DOS prompt.
Syntax: SET PROMPT=
(from the command line)
PROMPT=
(in a batch file)
To display current drive & current path followed by ">" as prompt
SET PROMPT=$P$G
To display the current date, time, and drive on separate lines
SET PROMPT $D$_$T$_$N$G
To redefine F9 to CD\Windows\Start Menu\Programs\Startup
SET PROMPT $e[0,67;"'CD\Windows\Start Menu\Programs\Startup'";13p