MS- DOS command and CMD commands help. About command. Availability. Syntax. Examples. About command. The command.
MS- DOS and is required for Microsoft operating systems. Without command. com the computer running a Microsoft operating system would be unable to boot. When running Windows NT, 2. XP, Vista, 7, 8, and 1. Cmd offers additional environment variables than command. MS- DOS utility that you utilize the command. To use command. com, click Start, Run, and type command.
Availability. Command, or command. Windows and MS- DOS, you would not be able to use the computer without this file. This file is available on all versions of Microsoft Windows and later versions of Windows use it to access the MS- DOS shell. All Versions of MS- DOSWindows 9. Windows 9. 8Windows MEWindows NTWindows 2.
Note that multiple commands separated by the command separator '&&' are accepted for string if surrounded by quotes. Also, for compatibility reasons, /X is the same. For this lesson we are going to fill in a couple of concepts that we will need before we go further with directories. Wildcards. Wildcards are characters that can be. As we saw in the last lesson, DOS uses directories to organize the files on your disks. That means we need to use directory commands to create.
Windows XPCMD, or CMD. EXE, is the command line shell introduced in Windows NT and available in all the below versions of Microsoft Windows. Windows NTWindows 2. Windows XPWindows Vista. Windows 7. Windows 8.
Windows 1. 0Syntax. Windows 2. 00. 0, XP, Vista, 7, 8, and 1. Early Windows "command" syntax. Windows 2. 00. 0, XP, Vista, 7, 8, and 1.
COPY Copies one or more files to another location. See note on DOS vs. Windows file names above. If trying to copy files longer the 8 characters, DOS will truncate. Navigating DOS For those who have never used a command line envornment, it can be a little confusing and frustraiting. But don't worry. It's still confusing and.
Starts a new instance of the Windows 2. Windows XP command interpreter. CMD [/A | /U] [/Q] [/D] [/E: ON | /E: OFF] [/F: ON | /F: OFF] [/V: ON | /V: OFF] [[/S] [/C | /K] string]/CCarries out the command specified by string and then terminates/KCarries out the command specified by string but remains/SModifies the treatment of string after /C or /K (see below)/QTurns echo off/DDisable execution of Auto.
Run commands from Registry (see below)/ACauses the output of internal commands to a pipe or file to be ANSI/UCauses the output of internal commands to a pipe or file to be Unicode/T: fg. Sets the foreground/background colors (see COLOR /? E: ONEnable command extensions (see below)/E: OFFDisable command extensions (see below)/F: ONEnable file and directory name completion characters (see below)/F: OFFDisable file and directory name completion characters (see below)/V: ONEnable delayed environment variable expansion using c as the delimiter. For example, /V: ON would allow ! The var syntax expands variables at input time, which is quite a different thing when inside of a FOR loop./V: OFFDisable delayed environment expansion. Note that multiple commands separated by the command separator '& & ' are accepted for string if surrounded by quotes. Also, for compatibility reasons, /X is the same as /E: ON, /Y is the same as /E: OFF and /R is the same as /C.
Any other switches are ignored. If /C or /K is specified, then the remainder of the command line after the switch is processed as a command line, where the following logic is used to process quote (") characters: 1. If all of the following conditions are met, then quote characters on the command line are preserved: - no /S switch- exactly two quote characters- no special characters between the two quote characters, where special is one of: & < > ()@^|- there are one or more whitespace characters between the two quote characters- the string between the two quote characters is the name of an executable file.
Otherwise, old behavior is to see if the first character is a quote character and if so, strip the leading character and remove the last quote character on the command line, preserving any text after the last quote character. If /D was NOT specified on the command line, then when CMD. EXE starts, it looks for the following REG_SZ/REG_EXPAND_SZ Registry variables, and if either or both are present, they are executed first. HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\Auto.
Runor. HKEY_CURRENT_USER\Software\Microsoft\Command Processor\Auto. Run. Command Extensions are enabled by default. You may also disable extensions for a particular invocation by using the /E: OFF switch. You can enable or disable extensions for all invocations of CMD.
EXE on a machine or user logon session by setting either or both of the following REG_DWORD values in the Registry using REGEDT3. EXE: HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\Enable.
Extensionsor. HKEY_CURRENT_USER\Software\Microsoft\Command Processor\Enable. Extensionsto either 0x. The user specific setting takes precedence over the machine setting.
The command line switches take precedence over the Registry settings. The command extensions involve changes or additions to the below commands. DEL or ERASECOLORCD or CHDIRMD or MKDIRPROMPTPUSHDPOPDSETSETLOCALENDLOCALIFFORCALLSHIFTGOTOSTART (also includes changes to external command invocation)ASSOCFType. To get specific details, type < command> /?
Where < command> is the name of the command you want specifics on. Delayed environment variable expansion is NOT enabled by default. You can enable or disable delayed environment variable expansion for a particular invocation of CMD. EXE with the /V: ON or /V: OFF switch. You can enable or disable completion for all invocations of CMD. EXE on a machine or user logon session by setting either or both of the following REG_DWORD values in the Registry using REGEDT3. EXE: HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\Delayed.
Expansionor. HKEY_CURRENT_USER\Software\Microsoft\Command Processor\Delayed. Expansionto either 0x. The user specific setting takes precedence over the machine setting. The command line switches take precedence over the Registry settings. If delayed environment variable expansion is enabled, then the exclamation character can be used to substitute the value of an environment variable at execution time. File and Directory name completion is NOT enabled by default. You can enable or disable file name completion for a particular invocation of CMD.
EXE with the /F: ON or /F: OFF switch. You can enable or disable completion for all invocations of CMD.
EXE on a machine or user logon session by setting either or both of the following REG_DWORD values in the Registry using REGEDT3. EXE: HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\Completion. Char. HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\Path. Completion. Charor. HKEY_CURRENT_USER\Software\Microsoft\Command Processor\Completion. Char. HKEY_CURRENT_USER\Software\Microsoft\Command Processor\Path. Completion. Charwith the hex value of a control character to use for a particular function (e.
Ctrl- D and 0x. 6 is Ctrl- F). The user specific settings take precedence over the machine settings. The command line switches take precedence over the Registry settings. If completion is enabled with the /F: ON switch, the two control characters used are Ctrl- D for directory name completion and Ctrl- F for file name completion. To disable a particular completion character in the Registry, use the value for space (0x. Completion is invoked when you type either of the two control characters. The completion function takes the path string to the left of the cursor appends a wild card character to it if none is already present and builds up a list of paths that match.
It then displays the first matching path. If no paths match, it just beeps and leaves the display alone. Thereafter, repeated pressing of the same control character will cycle through the list of matching paths.
Pressing the Shift key with the control character will move through the list backwards. If you edit the line in any way and press the control character again, the saved list of matching paths is discarded and a new one generated. The same occurs if you switch between file and directory name completion. The only difference between the two control characters is the file completion character matches both file and directory names, while the directory completion character only matches directory names. If file completion is used on any of the built- in directory commands (CD, MD or RD) then directory completion is assumed.
The completion code deals correctly with file names that contain spaces or other special characters by placing quotes around the matching path. Also, if you backup, then invoke completion from within a line, the text to the right of the cursor at the point completion was invoked is discarded. The special characters that require quotes are: < space> & ()[]{}^=; !'+,`~Early Windows "command" syntax.
Starts a new copy of the Windows Command Interpreter. COMMAND [[drive: ] path] [device] [/E: nnnnn] [/L: nnnn] [/U: nnn] [/P] [/MSG] [/LOW] [/Y [/C|K] command][drive: ]path.
Specifies the directory containing COMMAND. COM. device. Specifies the device to use for command input and output./E: nnnnn. Sets the initial environment size to nnnnn bytes.
L: nnnn. Specifies internal buffers length (requires /P as well). U: nnn. Specifies the input buffer length (requires /P as well). PMakes the new Command Interpreter permanent (can't exit)./MSGStores all error messages in memory (requires /P as well)./LOW Forces COMMAND to keep its resident data in low memory./YSteps through the batch program specified by /C or /K. Only available in MS- DOS 6.
C command Executes the specified command and returns./K command. Executes the specified command and continues running./ZDisplay the errorlevel of every command executed (Only available in MS- DOS 7. Examplescmd. Opens the cmd command shell. If you were already in a command shell and run the "cmd" or "command" command at the command line a new Windows command line would be opened. Typing "exit" would exit the new command line and return you back to the command line you ran the command from.
Using DOS, Introduction, Tips and Commands. Introduction, Commands and Tips.
Introduction(1)History(1)DOS/Win. NT/ME/XP/2. 00. 0(1)Command Index(1)Navigating DOS(2)Tips and Tricks(2)Network/Harware Utilities(3)How to make and use bootable floppy disks(3)Batch Files(4)Creating Batch Files(4)Batch file utilities and commands(4)The AUTOEXEC.
BAT file(4)Types of Batch and System Files(4)Parameters in batch files(4)Batch File Library(5)Subject Index(5)Helpful DOS Links(5)Opening DOS(Windows). If you are using Windows 3. Main" folder. for MSDOS Prompt.
Click on it. 9. 5/9. Start, Programs, MS- DOS Prompt. OR Start, Run, and type. COMMAND": Start, Programs, MS- DOS Prompt.
OR Start, Run, and type. CMD"Now, a black window should appear with prompt like this: "C: \WINDOWS> ". If you are using NT it will only say "C: \". It should look like this: If the DOS window fills up the whole screen, type EXIT. MS- DOS Icon, click "Properties" and select the.
Screen" tab, click on "Window" instead of "Full- screen", click on "Ok". DOS window. If you are using the OS/2 platform, follow these instructions for opening a DOS session. Open the "OS/2 System" folder. Open the "Command Prompts" folder.
Click on the "DOS Window" icon. Open a command line in NT/2x.
Go to Start, Run, type "COMMAND". In previous versions this was done by entering CMD.
In some versions. NT entering CMD may invoke previous versions of DOS. In some versions of WIN2x, CMD will open a command line with. COMMAND will open the window with the. NT/2x Directory System. NT uses user profiles. Each user will have.
Desktop and My Documents folders under. There is no directory called "Windows", but there. WINNT." Most NT system files will be found in. C: \WINNT\System or C: \WINNT\System. In some cases. %System. Root% is used to address the system drive. Windows or WINNT.
The different user set- ups are in the C: \Documents and settings. C: \DOCUME~1. In this directory there will be. You may. also see Administrator, Default User, All Users and some other funny. Each folder will have its own Desktop, Start. Menu, My Documents, Cookies, Favorites and whatever directory structure. Programs everyone access are. C: \program files or C: \progra~1(same as Windows).
For those who have never used a command line envornment, it can be a little confusing and frustraiting. But don't worry. It's still confusing and frustraiting for people who have been doing it for years. Start by using the DIR command. At the C: \WINDOWS> prompt type DIR for "directory". A list of. files should fly up the screen faster than you can read. When the prompt comes.
DIR/P. This will allow the list to be read one. Hit enter a few times to get to the end of the list and back. DIR is a program that reads scans the current directory and.
P is called a switch. The P stands for "page". I can never find out which). When you type DIR/P you are passing. P to the program DIR as a Parameter. You can pass. other parameters to DIR.
Try typing DIR/W, this puts the file. Now try this, DIR R*.*. This will display all the. R. The "*.*" part of the parameter is called a wildcard. A wildcard tells the program that anything after the letter R does not matter. Try this one. DIR *.*EXE.
This will display all the files with the . EXE extension. DIR will display all the files, directories, file sizes, time and date or creation.
DIR|MORE will show you the list and prompt to continue. Similar to DIR/P. DIR/B for bare or brief, shows only the filenames and their extensions. In early systems there was an 8 character limit on file names and directory names. Directory names and file names.
This scheme still plays a big role in navigating DOS. The standard. Windows folder "Program Files" is called "PROGRA~1." The general rule is to count 6 characters in: "PROGRA" then. Since we may have multiple files or directories with similar names, we have numbers at the. The number is determined by which file or directory was created first. Since. Program Files is a built- in directory it gets a 1. If you create a new directory called "Programs" the DOS name.
PROGRA~2". To view the DOS names, use this command: DIR/XIn some Windows versions you can open a DOS prompt in specific directory by first navigating to it through Windows Explorer. Start, Run, CMD or COMMAND. In most cases it will open the default. PATH directory. For a full list of DIR possibilities enter DIR/? In DIR you placed various slashes and letters after the commands. These are "switches" that modify. Every command has a different set of switches.
A "/A" may mean something. Sometimes a switch may be preceded by a - .
For each command look at the help file. You may view the help file of any command by typing the command followed. HELP in older versions. Now for a different command.
Type in CD. this should set the prompt to "C: \". C: , C: \WINDOWS is a sub- directory of C.
CD stands for "Change Directory", a program that allows you to move around the. The . parameter you passed to program CD tells.
Now pass a different parameter, type CD. C: \WINDOWS\DESKTOP. This will change your directory level to the Desktop folder. Type DIR/P. and look at the file listing briefly. Now minimize the DOS window and look at your Windows Desktop.
You should see all the same files. Most of the file extensions will be . LNK meaning. that they are shortcuts. CD will allow you navigate through the whole directory structure. You may also look at floppy disks: CD A: (sometimes B: also), or CDROMs: CD. D: (sometimes E: ).
CD. puts you in the parent directory(up one level)CD. As stated in the DIR section there is an 8 character limit for directory names for many DOS systems.
When. using CD to move to a directory with a long name be sure to know the DOS name. Example: CD progra~1 to go to "program files" if you are in the root of C: \, otherwise use. CD C: \progra~1 from any other directory. Using drive letters as commands.
To switch from one drive to another simply type the drive letter. Example: D: or A. For removable media(floppy, CDROM) you must have the media in the drive to move to it. PATH sets a directory search order. This is useful in many.
For example, if you are using a. DOS operating system from that disk and the more complex commands will only. If you are at the A: prompt and want to run a. C: you must type FIND C: \myfile to use the. C: you would need to type A: \FIND C: \myfile. To make things easier, type PATH A: \ at the C: \ prompt.
This way. the operating system will know to access A: for all the commands. Some installation programs(especially development environments) will add a line to the. PATH=%PATH%; C: \MSSQL7\BINN this allows programming.
Type in DOSKEY at the prompt, the DOSKEY program is now loaded. You may view your history by hitting the Up- arrow on your keypad. DOSKEY is active in NT by default, but not in Win. K. Consitency is not one of. Microsoft's strong points. DEL is the Delete program in DOS.
DEL allows you to delete files. For example. typing DEL TEMP.
TMP will delete the file temp. Warning! Using. the DEL command in DOS is not like deleting in Windows.
Recycle Bin, the files are gone. If you accidentally delete. Only delete files that you are sure about. At the command prompt type EDIT. The screen should turn blue with a menu bar at the top. This is the DOS EDIT program and it can come in handy. Click on the "File" menu then.
Exit". You should be back at the prompt. With EDIT you can view and alter just. Windows will not allow you to.
Warning! Altering system or program files in EDIT can have serious consequences. Make copies of any. Believe. me, making copies is much easier that reloading your operating system. This time EDIT. TEST. TXT this will open the editor and create a text file called "test. Type in some random.
For a moment stop using your mouse. Press < -Alt- > and then the Down- arrow on your key pad. This. will dropdown the "File" menu. This is how navigation was done before the mouse. Learning how to use the. Save your work and exit the editor. In some early versions of DOS it was called "EDLIN." If EDIT doesn't.
EDLIN instead. REN is short for "rename" and is used to rename files. Warning! Renaming files is as bad as deleting or altering them.
Renaming system files can cause errors since the. Type in REN TEST. TXT TEST. DOC. This will rename the text. MSWord Document. You may now open Word and edit the TEST file like any. Word file. Type REN TEST. DOC MYFILE. DOC. This renames the file as "myfile" but. MSWord document. TYPE is a program that will show the contents of a file without opening it for.
Try entering TYPE MYFILE. DOC and you should see the contents of the file. Earlier you learned how to use the /p switch with the DIR command. There is. another device which allows you to view directories and file contents a page at a time. Use the previous command to demonstrate. TYPE MYFILE. DOC |MORE and hit < enter >.
If the file you selected it several pages long, DOS will display the first page and then at the bottom. DOS is waiting for you to continue. Hit < enter > and.
Type this at the prompt to close the current DOS session. This is a very usefull tool for searching files for strings(text). If you have lost a file or renamed. FIND to locate it.
For example if. your name is Joe and the missing file has your name in it, enter FIND "Joe" at the prompt. DOS will search the current directory for any file containing the string "Joe."Use this to create and name your own DOS/Windows directory.
MD test, creates a directory named "test"Use this to remove directories. RD test. Moves files from one location to another, as opposed to copying.
MOVE test. txt A: \, moves the file "test. A: drive. Copies files.
COPY C: \myfile. txt A: \myfile. Extended" COPY. Copies files from one or more subdirectories.
Slightly more powerful than COPY. XCOPY has all the same functions as COPY but these. D: m- d- y Copies files changed on or after the specified date. If no date is given, copies only those files whose. EXCLUDE: file. 1[+file.
Specifies a list of files containing strings.