Command Reference Guide
This document lists the Command Prompt commands discussed in these articles, along with their arguments and what they do. Arguments contained in square brackets are optional. Several of these commands accept more than three optional arguments, but only up to three are listed.
The roughly equivalent Bash command is also listed in the table, for reference.
A full listing of Windows commands can be found here.
Basic File Commands
Command | Argument1 | Argument2 | Argument3 | Bash Equivalent | Task |
---|---|---|---|---|---|
cls | none | none | none | clear | Clear all text from the console |
notepad | file | none | none | nano | Open file for editing, if it exists. If it doesn’t exist, then create it. |
type | file | [file2] | [file3] | cat | Write the contents of a file to stdout. If multiple files are specified, write them all, in order. |
copy | source | target | none | cp | Create an exact copy of source, called target. |
move | source | target | none | mv | Move source to target. |
del | file | [file2] | [file3] | rm | Delete the specified files. |
fc | file1 | file2 | none | diff | Do a line by line comparison of file1 and file2, writing the differences to stdout. |
Basic Directory Commands
Command | Argument1 | Argument2 | Argument3 | Bash Equivalent | Task |
---|---|---|---|---|---|
cd | none | none | none | pwd | Write the working directory to stdout. |
cd | directory | none | none | cd | Change the working directory. |
dir | [directory] | none | none | ls | Write a listing of the contents of the specified directory, or the working directory if one is not specified, to stdout. |
mkdir | directory | none | none | mkdir | Create a new directory of the specified name. |
rmdir | directory | none | none | rmdir | Delete the specified empty directory. |
Environment Variables
Command | Argument1 | Argument2 | Argument3 | Bash Equivalent | Task |
---|---|---|---|---|---|
echo | arg1 | [arg2] | [arg3] | echo | Write the value of all arguments, in order, to stdout. |
set | none | none | none | export | Write a list of all environment variables, and their values, to stdout. |
set | variable=string | none | none | export | Set the value of a variable to string. If the variable exists already, it is updated. Otherwise it is created. Note the syntax, it’s one argument (no spaces) with the variable name and value seperated by an =. |
setx | variable | string | none | export | Set the value of variable to string, and update it in the user registry. This makes the variable persistant. |