A list of common windows CMD commands.
Update Ongoing
This list will be updated.
The full list offered by MS is here. I will put some commone ones in this post.
If any command cannot be found: check env variables / sys variables; go toC:\Windows\System32
and open CMD there.
Basics
shutdown
- shut down the computercmd
- start cmdecho
- output textver
- display OS versysteminfo
- display all system infotasklist
- display applications and related tasksdate
- show/set datetime
- show/set time
Type /?
behind a command name to see its help (--help
for Bash)
Wildcards: *
matches any sequence of chars, ?
matches a single char.powercfg
- print battery statschkdsk /f
- check a drive integrityread
- read user input (put this as the last line of a batch file to avoid closing on finishing)
Visual
title
- set console titlecolor
- change console colorcls
- clear the screen
Run
To start a .exe, just enter its full path and name. Fro batch files,start
- create a new cmd.exe and start the batch file, variables not sharedcall
- run the batch file in the same cmd window, sharing variablestaskkill
- terminate a process or a application
Ctrl+C to terminate a run.exit
- quit cmdtimeout <num of sec>
- wait for secs or keystroke (-1 means forever)schtasks
- schedule a task
Network
ping
- pings the networkipconfig
- display IP network settingsnetstat
- get a list of all active TCP connections from computernet use Z: "..." /persistent:yes
- establish a mapping of drive to Z:
Navigation
d:
or D:
- change the current drive to “D:/“cd <path>
- go to the specified path
(in the same disk only)
Common Pitfalls
Do not use Chinese characters in path.
Try "/" and "\".
cd ..
- go back to the parent directorycd
or cd ~
- go back to the home directory (Bash only)%cs%
- (not a command) pwd
File
dir
- list directory content (this should be ls
in Bash)tree
- display file structuremkdir
- create an empty foldertouch
- create a file with the specified formatrmdir
- delete a folderren
or rename
- rename a folder or filedel
or erase
- delete a file (del
does not accept wildcard)move <source_file_path> <destination_file_path>
move a filereplace <source_file_path> <destination_dir_path>
replace all files in destination_dir with source_file (including all sub-folders)attrib
- get/set file attributesfind
or findstr
- searchcopy
xcopy
or robocopy
- copy filesmove
- move files (mv
in Bash)unzip
- unzip (Bash Only)
- Post link: https://reimirno.github.io/2021/08/05/Common-CMD-Commands/
- Copyright Notice: All articles in this blog are licensed under unless otherwise stated.
GitHub Discussions