Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
All supported versions of Windows and Windows Server have a set of Win32 console commands built in. This set of documentation describes the Windows Commands you can use to automate tasks by using scripts or scripting tools.
Command-line shells
Windows has two command-line shells: the Command shell and PowerShell. Each shell is a software program that provides direct communication between you and the operating system or application, providing an environment to automate IT operations.
The Command shell was the first shell built into Windows to automate routine tasks, like user account management or nightly backups, with batch (.bat) files. With Windows Script Host, you could run more sophisticated scripts in the Command shell. For more information, see cscript or wscript. You can perform operations more efficiently by using scripts than you can by using the user interface. Scripts accept all commands that are available at the command line.
PowerShell was designed to extend the capabilities of the Command shell to run PowerShell commands called cmdlets. Cmdlets are similar to Windows Commands but provide a more extensible scripting language. You can run both Windows Commands and PowerShell cmdlets in PowerShell, but the Command shell can only run Windows Commands and not PowerShell cmdlets.
For the most robust, up-to-date Windows automation, we recommend using PowerShell instead of Windows Commands or Windows Script Host for Windows automation.
A reference of exit and error codes for Windows Commands can be found in the Debug system error codes articles that may be helpful to understanding errors produced. Windows Commands also include command redirection operators. To learn more of their use, see Using command redirection operators.
Note
You can also download and install PowerShell Core, the open source version of PowerShell.
Command shell file and directory name automatic completion
You can configure the Command shell to automatically complete file and directory names on a computer or user session when a specified control character is pressed. By default this control character is configured to be the tab key for both file and directory names, although they can be different. To change this control character, run regedit.exe and navigate to either of the following registry keys and entries, depending on whether you wish to change the value for the current user only, or for all users of the computer.
Caution
Incorrectly editing the registry may severely damage your system. Before making the following changes to the registry, you should back up any valued data on the computer.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor\CompletionChar
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor\PathCompletionChar
Set these values to that of the control character you wish to use. See virtual key codes for a complete list. To disable a particular completion character in the registry, use the value for space (0x20) as it isn't a valid control character. The type of value for this registry entry is REG_DWORD, and can also be specified by hexadecimal or decimal value.
You can also enable or disable file and directory name completion per instance of a Command shell by running cmd.exe with the parameter and switch /F:ON or /F:OFF. If name completion is enabled with the /F:ON parameter and switch, the two control characters used are Ctrl-D for directory name completion and Ctrl-F for file name completion. User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.
Command-line reference A-Z
To find information about a specific command, in the following A-Z menu, select the letter that the command starts with, and then select the command name.
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z
A
activeaddadd aliasadd volumeadprepappendarpassignassocatatmadmattach-vdiskattribattributesauditpolautochkautoconvautofmtautomount
B
bcdbootbcdeditbdehdcfgbegin backupbegin restorebitsadminbitsadmin addfilebitsadmin addfilesetbitsadmin addfilewithrangesbitsadmin cachebitsadmin cancelbitsadmin completebitsadmin createbitsadmin examplesbitsadmin getaclflagsbitsadmin getbytestotalbitsadmin getbytestransferredbitsadmin getclientcertificatebitsadmin getcompletiontimebitsadmin getcreationtimebitsadmin getcustomheadersbitsadmin getdescriptionbitsadmin getdisplaynamebitsadmin geterrorbitsadmin geterrorcountbitsadmin getfilestotalbitsadmin getfilestransferredbitsadmin gethelpertokenflagsbitsadmin gethelpertokensidbitsadmin gethttpmethodbitsadmin getmaxdownloadtimebitsadmin getminretrydelaybitsadmin getmodificationtimebitsadmin getnoprogresstimeoutbitsadmin getnotifycmdlinebitsadmin getnotifyflagsbitsadmin getnotifyinterfacebitsadmin getownerbitsadmin getpeercachingflagsbitsadmin getprioritybitsadmin getproxybypasslistbitsadmin getproxylistbitsadmin getproxyusagebitsadmin getreplydatabitsadmin getreplyfilenamebitsadmin getreplyprogressbitsadmin getsecurityflagsbitsadmin getstatebitsadmin gettemporarynamebitsadmin gettypebitsadmin getvalidationstatebitsadmin helpbitsadmin infobitsadmin listbitsadmin listfilesbitsadmin makecustomheaderswriteonlybitsadmin monitorbitsadmin nowrapbitsadmin peercachingbitsadmin peersbitsadmin rawreturnbitsadmin removeclientcertificatebitsadmin removecredentialsbitsadmin replaceremoteprefixbitsadmin resetbitsadmin resumebitsadmin setaclflagbitsadmin setclientcertificatebyidbitsadmin setclientcertificatebynamebitsadmin setcredentialsbitsadmin setcustomheadersbitsadmin setdescriptionbitsadmin setdisplaynamebitsadmin sethelpertokenbitsadmin sethelpertokenflagsbitsadmin sethttpmethodbitsadmin setmaxdownloadtimebitsadmin setminretrydelaybitsadmin setnoprogresstimeoutbitsadmin setnotifycmdlinebitsadmin setnotifyflagsbitsadmin setpeercachingflagsbitsadmin setprioritybitsadmin setproxysettingsbitsadmin setreplyfilenamebitsadmin setsecurityflagsbitsadmin setvalidationstatebitsadmin suspendbitsadmin takeownershipbitsadmin transferbitsadmin utilbitsadmin wrap
bootcfgbreak
C
caclscallcdcertreqcertutilchangechcpchdirchglogonchgportchgusrchkdskchkntfschoiceciphercleancleanmgrclipclscmdcmdkeycmstpcolorcompcompactcompact vdiskconvertcopycreatecscript
D
datedcdiagdcgpofixdcpromodefragdeldeletedetach vdiskdetaildfsdiagdfsrmigdiantzdirdiskcompdiskcopydiskpartdiskperfdiskraiddiskshadowdispdiagdnscmddoskeydriverquerydtrace
E
echoeditendlocalend restoreeraseeventcreateEvntcmdexecexitexpandexpand vdiskexposeextendextract
F
fcfilesystemsfindfindstrfingerflattempfondueforforfilesformatfreediskfsutilftpftp appendftp asciiftp bellftp binaryftp byeftp cdftp closeftp debugftp deleteftp dirftp disconnectftp getftp globftp hashftp lcdftp literalftp lsftp mgetftp mkdirftp mlsftp mputftp openftp promptftp putftp pwdftp quitftp quoteftp recvftp remotehelpftp renameftp rmdirftp sendftp statusftp traceftp typeftp userftp verboseftp mdeleteftp mdir
ftypefveupdate
G
H
I
J
K
klistksetupksetup addenctypeattrksetup addhosttorealmmapksetup addkdcksetup addkpasswdksetup addrealmflagsksetup changepasswordksetup delenctypeattrksetup delhosttorealmmapksetup delkdcksetup delkpasswdksetup delrealmflagsksetup domainksetup dumpstateksetup getenctypeattrksetup listrealmflagsksetup mapuserksetup removerealmksetup serverksetup setcomputerpasswordksetup setenctypeattrksetup setrealmksetup setrealmflags
ktmutilktpass
L
labellistload metadatalodctrlogmanlogman createlogman create alertlogman create apilogman create cfglogman create counterlogman create tracelogman deletelogman import and logman exportlogman querylogman start and logman stoplogman updatelogman update alertlogman update apilogman update cfglogman update counterlogman update trace
logofflpqlpr
M
macfilemakecabmanage bdemanage bde statusmanage bde onmanage bde offmanage bde pausemanage bde resumemanage bde lockmanage bde unlockmanage bde autounlockmanage bde protectorsmanage bde tpmmanage bde setidentifiermanage bde forcerecoverymanage bde changepasswordmanage bde changepinmanage bde changekeymanage bde keypackagemanage bde upgrademanage bde wipefreespace
mapadminmdmerge vdiskmkdirmklinkmmcmodemoremountmountvolmovemqbkupmqsvcmqtgsvcmsdtmsgmsiexecmsinfo32mstsc
N
nbtstatnetcfgnetdomnet printnet usernetshnetsh addnetsh advfirewallnetsh branchcachenetsh bridgenetsh deletenetsh dhcpclientnetsh dnsclientnetsh dumpnetsh execnetsh httpnetsh interfacenetsh ipsecnetsh lannetsh mbnnetsh namespacenetsh netionetsh nlmnetsh rasnetsh rpcnetsh setnetsh shownetsh tracenetsh wcnnetsh wfpnetsh winhttpnetsh winsocknetsh wlan
netstatnfsadminnfssharenfsstatnlbmgr- nltest
nslookupnslookup exit Commandnslookup finger Commandnslookup helpnslookup lsnslookup lservernslookup rootnslookup servernslookup setnslookup set allnslookup set classnslookup set d2nslookup set debugnslookup set domainnslookup set portnslookup set querytypenslookup set recursenslookup set retrynslookup set rootnslookup set searchnslookup set srchlistnslookup set timeoutnslookup set typenslookup set vcnslookup view
ntbackupntcmdpromptntfrsutl
O
P
pagefileconfigpathpathpingpausepbadminpentntperfmonpingpktmonpnpunattendpnputilpopdpowershellpowershell iseprintprncnfgprndrvrprnjobsprnmngrprnportprnqctlpromptpubprnpushdpushprinterconnectionspwlauncher- pwsh
Q
R
rdrdpsignrecoverrecover disk grouprefsutilregreginiregsvr32relogremremoverenrename- repadmin
repairreplacerescanresetretainrevertrexecrisetuprmdirrobocopyroute ws2008rpcinforpcpingrshrundll32rundll32 printuirwinsta
S
sansc configsc createsc deletesc queryschtasksscwcmdseceditselectserverceipoptinservermanagercmdserverweroptinset environmental variablesset shadow copysetlocalsetspnsetxsfcshadowshiftshowmountshrinkshutdownsimulate restoresortstartsubcommand set devicesubcommand set drivergroupsubcommand set drivergroupfiltersubcommand set driverpackagesubcommand set imagesubcommand set imagegroupsubcommand set serversubcommand set transportserversubcommand set multicasttransmissionsubcommand start namespacesubcommand start serversubcommand start transportserversubcommand stop serversubcommand stop transportserversubstsxstracesysmonsysocmgrsysteminfo
T
takeowntapicfgtaskkilltasklisttcmsetuptelnettftptimetimeouttitletlntadmntpmtooltpmvscmgrtracerpttracerttreetscontsdiscontsecimptskilltsproftypetypeperftzutil
U
V
W
waitforwbadminwbadmin delete catalogwbadmin delete systemstatebackupwbadmin disable backupwbadmin enable backupwbadmin get diskswbadmin get itemswbadmin get statuswbadmin get versionswbadmin restore catalogwbadmin start backupwbadmin start recoverywbadmin start sysrecoverywbadmin start systemstatebackupwbadmin start systemstaterecoverywbadmin stop job
wdsutilwecutilwevtutilwherewhoamiwinntwinnt32winrswinsat memwinsat mfmediawmicwriterwscript