command /? | man command | Shows the help for command |
bitsadmin | wget or curl | Downloads a remote file |
certutil -hashfile file_name MD5 | md5sum file_name | Gets the MD5 checksum of file_name |
cd | pwd | Displays the current directory |
cd directory | cd directory | Changes the current directory to the specified one |
cls | clear | Clears the screen |
copy | cp | Copies a file or files from a source path to a target path |
date | date | Displays the date or sets it based on user input |
del | rm | Deletes a file or files |
dir | ls | displays a list of files and directories in the current directory |
echo | echo | Displays text on the screen |
exit | return | Exits a script or subroutine |
exit | logout | Closes the command prompt or terminal |
fc | diff | Compares the contents of two files |
find "string" file_name | grep "string" file_name | Searches file_name for string |
findstr "string" file_name | grep "string" file_name | Searches file_name for string |
for /F %A in (fileset*) do something | for item in fileset*; do; something; done | Do something for every file in a set of files |
for /F %A in ('command') do something | `command` | Returns the output of a command |
for /L %A in (first,increment,last) do something | for item in `seq first increment last`; do; something; done | Starts at first and counts by increment until it reaches last |
forfiles | find | Searches for files that match a certain criteria |
if "%variable%"=="value" ( | if [ "variable"="value" ]; then | Compares two values |
ipconfig | ifconfig | Displays IP information |
md | mkdir | Creates new folders |
mklink | ln -s | Creates a symbolic link |
more | more | Displays one screen of output at a time |
move | mv | Moves a file or files from a source path to a target path |
pause | read -p "Press any key to continue" | Pauses script execution until the user presses a button |
popd | popd | Removes the top entry from the directory stack and goes to the new top directory |
pushd | pushd | Adds the current directory to the directory stack and goes to the new top directory |
ren | mv | Renames files |
rem or :: | # | Comments a line of code |
rd | rmdir | Removes empty directories |
rd /s | rm -rf | Removes directories regardlesss of whether or not they were empty |
set variable=value | variable=value | Sets the value of variable to value |
set /a variable=equation | variable=$((equation)) | Performs math (batch can only use 32-bit integers) |
set /p variable=promptstring | read -p "promptstring" variable | Gets user input and stores it in variable |
shift | shift | Shifts arguments by 1 (or n if provided) |
sort | sort | Sorts output alphabetically by line |
tasklist | ps | Shows a list of running processes |
taskkill /PID processid | kill processid | Kills the process with PID processid |
time /t | date | Displays the current time |
type | cat | Displays the contents of a file |
where | which | Searches the current directory and the PATH for a file or command |
whoami | id | Displays the name and group of the current user |