Win Command Line Ref
Win Command Line Ref
CIS 114
Esther Frankel
General Commands:
Command Usage Ch
command /? or HELP Help command 2
CLS Clear screen of output 1
VER Display operating system version 1
DATE Display / change system date 1
TIME Display / change system time 1
PATH dir; dir Display / change search path for programs 4
PROMPT text Change the command line prompt 4
SET Display / change environment variable 11
EDIT Start editor 7
command < destination Redirect standard input 9
command > destination Redirect standard output 9
command >> destination Append output to location following symbol 9
command | command Pipe 9
SORT Change order of information displayed 9
MORE Display one screen at a time 9
FIND “string” filename Finds text string within a file 9
START “text” program Starts a program in a new window 10
Directory & File Management Commands:
Command Usage Ch
DIR Show file information 1
MKDIR (or MD) directoryname Create directory 4
RMDIR (or RD) directoryname Remove (delete) directory (must be empty) 4
CHDIR (or CD) directoryname Display or change default directory 2
TREE View directory structure 8
MOVE filename filename Rename files / directories or change location of file 4&6
TYPE filename Display contents of ASCII file 5
COPY filename filename Copy files 5
XCOPY filename filename Copy files and directory trees 7
REN(AME) filename filename Rename file 6
DEL (or ERASE) filename Delete file 6
PRINT filename Print file at printer (ASCII files only) 5
FC filename filename Display the differences between two files -----
ATTRIB {+/- attrib} filename Display or change file attributes 7
attributes are: R(ead only), A(rchive), H(idden), S(ystem)
Disk Management Commands:
Command Usage Ch
driveletter: Change default drive 2
DISKCOPY driveletter: driveletter: Copy entire disk to another 1&6
FORMAT driveletter: Formats a disk (removes existing data) 3
LABEL Places volume label on disk 3
VOL Display disk volume label 3
CHKDSK Checks disk integrity 8
SUBST driveletter: directoryname Display / assign a path to a drive letter 7
1
Italics indicate that you supply the value.
Command-Line Editing and DOSKEY Reference:2
Command Usage
/LISTSIZE=size Sets size of command history buffer
/HISTORY Display list of commands in memory
/INSERT Change editing to insert mode
/OVERSTRIKE Change editing to overstrike mode
/MACROFILE=macrofile Recall macro file
/MACROS Display list of macros
macrofile = text Create a macro with text as command
Backspace Erase letter before cursor
Delete key Erase letter at cursor
Esc Cancel command entered at prompt
Insert key Change from insert to overstrike mode
Up/down arrow Move up (down) through command list
Page Up/down Display oldest (newest) command in list
Esc Cancel command
F7 Display numbered history list
Alt+F7 Clear the history list
text F8 Searches history list for command starting with text
F9 Enter line number displayed by F7
Batch File Commands:
Command Usage
CTRL-C or CTRL-BREAK Stops (and exits) batch file
ECHO text Display text at screen
ECHO ON/OFF Controls command echoing on / off (default on)
ECHO. Skips a line in a display
REM or :: Remarks (computer ignores what follows)
PAUSE text Stops batch file until user presses a key
IF [NOT] str1==str2 command If strings do (not) match, perform command
IF [NOT] EXIST filename command If file does (not) exist, perform command
IF [NOT] ERRORLEVEL errnum If the previous program does (not) return error code
command greater than or equal to the error number, perform
command
FOR %[%]variable IN (set) DO Performs command for each file in set of files; % is used
command interactively; %% is used in batch files
GOTO label Processing moves to :label in batch file
SETLOCAL Sets “localization” of environment variables
ENDLOCAL Ends “localization” of environment variables
CALL batchfile Executes separate batch file
SHIFT Changes the position number of the parameter
Reserved Device Names:
Name Device
PRN, LPT Printer
CON Console (keyboard/monitor)
NUL “Null” device
2
Switches are for DOSKEY command.
Common Environment Variables:
Name Usage
COMSPEC Location of the Windows shell
DIRCMD Parameter settings for DIR command
NUMBER_OF_PROCESSORS Number of processors on computer
OS Operating system name
PATH Search path for commands
PATHEXT File extensions recognized as programs
PROCESSOR_ARCHITECTURE The computer’s processor type
PROCESSOR_IDENTIFIER Detailed description of computer’s processor
PROCESSOR_LEVEL Processor’s stepping level
PROCESSOR_REVISION Processor’s revision number
PROMPT Prompt setting
SYSTEMROOT Location of Windows OS software
TEMP Location for temporary files (used by applications)
TMP Location for temporary files (alternate)
USERNAME Login name
USERPROFILE Default location used to save files
WINDIR Location of Windows folder
Network Utilities:
Name Usage
ARP Display/modify IP-Ethernet translation tables
FTP File transfer protocol (see additional commands below)
IPCONFIG Display IP address and other configuration information
NETSTAT Displays TCP/IP connections and protocol statistics
PING Verifies connection to remote computer
ROUTE Controls network routing tables
TELNET Terminal emulation utility
TRACERT Displays route taken to remote computer
FTP Commands:
Name Usage
binary Sets the transfer mode to binary (transfer a binary file)
cd directory Change directory
close Disconnects from session
dir Get directory listing
get filename Downloads file from remote computer
help Get help
lcd directory Change (current local) directory
ls Get directory listing
open machine Connect to remote computer
put filename Uploads file from remote computer
quit Exit ftp (and also closes session)