Windows commands | Microsoft Learn

All supported versions of Windows and Windows Server have a set of built-in Win32 console commands. This documentation set describes Windows commands that 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 for automating IT operations.

The

command shell was the first shell built into Windows to automate routine tasks, such as user account management or nightly backups, with batch files (.bat). With Windows Script Host, you can 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 by using the user interface. The scripts accept all commands that are available on the command line.

PowerShell was designed to extend the capabilities of the command shell to execute PowerShell commands called cmdlets. Cmdlets are similar to Windows commands, but provide a more extensible scripting language. You can run Windows commands and PowerShell cmdlets in PowerShell, but the command shell can only run Windows commands and not PowerShell cmdlets.

For the most robust and up-to-date Windows Automation, we recommend that you use PowerShell instead of Windows Commands or Windows Script Host for Windows Automation.

You can find a reference to the exit and error codes for Windows commands in the Debugging system error codes articles that may be helpful in understanding the errors that occur. Windows commands also include command redirection operators. For more information about using them, see Using Command Redirection Operators.

Automatic completion of the command shell file and directory

name

You can configure the command shell to automatically populate file and directory names on a computer or user session when a specified control character is pressed. By default, this control character is set to be the tab key for file and directory names, although they may be different. To change this control character, run regedit.exe and navigate to any of the following registry keys and entries, depending on whether you want to change the value only for the current user or for all users on the computer.

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor\CompletionChar HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor\PathCompletionChar HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor\CompletionChar HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor\PathCompletionChar

Set these values to the control character you want to use. See virtual key codes for a complete list. To disable a particular ending character in the registry, use the space value (0x20) because it is not a valid control character. The value type for this registry entry is REG_DWORD and can be specified by using a hexadecimal or decimal value.

You can also enable or disable the termination of file and directory names by instance of a command shell by running cmd.exe with the /F:ON or /F:OFF parameter and switch. If name ending is enabled with the /F:ON parameter and the switch, the two control characters used are Ctrl-D to complete the directory name and Ctrl-F to complete the file name. User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.

A to Z

command-line reference

To find information about a specific command, from the next menu from A to Z, select the letter with which the command begins, and then select the name of the command. A

| M S C | D | E | F | G | H | I | J | K | L | M | N | OR | P | P | R | S | T | U | V | W | X | AND | Z

A

  • active
  • add add

  • alias
  • add

  • add
  • volume

  • append
  • arp
  • assign
  • assoc
  • at
  • atmadm
  • attach-vdisk
  • attrib
  • attributes

    • attributes disk attributes
    • volume
  • auditpol auditpol audit pol backup auditpol clear auditpol get auditpol list auditpol remove auditpol resourcesacl

    • auditpol
    • restore

    • auditpol set
  • autochk
  • autoconv autofmt
  • automount

B

bcdboot bcdedit bdehdcfg bdehdcfg driveinfo bdehdcfg newdriveletter bdehdcfg silent bdehdcfg restart bdehdcfg

    • size
    • bdehdcfg
  • destination start

  • backup
  • start restore
  • bitsadmin

    • bitsadmin addfile
    • bitsadmin addfileset

    • bitsadmin

    • addfilewithranges
    • bitsadmin cache bitsadmin cache bitsadmin cache and delete bitsadmin cache and deleteurl bitsadmin cache and getexpirationtime bitsadmin cache and getlimit bitsadmin cache and help bitsadmin cache and information bitsadmin cache

      • and list bitsadmin
      • cache and

      • setexpirationtime
      • bitsadmin

      • cache and
    • setlimit bitsadmin cache and clear bitsadmin cancel bitsadmin cache and setlimit bitsadmin

    • cancel
    • bitsadmin complete bitsadmin create

    • bitsadministration examples
    • bitsadmin

    • getaclflags
    • bitsadmin

    • getbytestotal bitsadmin getbytestransferred bitsadmin getclientcertificate
    • bitsadmin

    • getcompletiontime
    • bitsadmin getcreationtime bitsadmin getcustomheaders bitsadmin getdescription bitsadmin getdisplayname

    • bitsadmin
    • geterror bitsadmin

    • geterrorcount
    • bitsadmin getfilestotal

    • bitsadmin

    • getfilestransferred
    • bitsadmin gethelpertokenflags bitsadmin

    • gethelpertokensid
    • bitsadmin gethttpmethod bitsadmin getmaxdownloadtime bitsadmin

    • getminretrydelay
    • bitsadmin

    • getmodificationtime bitsadmin getnoprogressout
    • bitsadmin getnotifycmdline bitsadmin getnotifyflags

    • bitsadmin
    • getnotifyinterface
    • bitsadmin getowner bitsadmin

    • getpeercachingflags
    • bitsadmin getpriority bitsadmin

    • getproxybypasslist bitsadmin getproxylist
    • bitsadmin

    • getproxyusage bitsadmin getreplyfilename bitsadmin getreplyprogress
    • bitsadmin

    • getsecurityflags
    • bitsadmin

    • getstate bitsadmin gettemporaryname
    • bitsadmin

    • gettype
    • bitsadmin bitsadmin

    • GetValidationState
    • bitsadmin help bitsadmin information bitsadmin bitsadmin bitsadmin

    • listfiles
    • bitsadmin

    • makecustomheaderswriteonly
    • bitsadmin monitor bitsadmin

    • nowrap
    • bitsadmin peercaching bitsadmin peercaching and getconfigurationflags bitsadmin peercaching and help bitsadmin peercaching and

    • setconfigurationflags

    • bitsadmin

      • peercaching and set configurationflags
      • bitsadmin peers

      • bitsadmin peers and clear bitsadmin peers and discover bitsadmin peers and help bitsadmin peers and list bitsadmin rawreturn bitsadmin removeclientcertificate bitsadmin removecredentials bitsadmin replaceremoteprefix bitsadmin reset bitsadmin resume bitsadmin setaclflag bitsadmin

    • setclientcertificatebyid bitsadmin setclientcertificatebyclient setclientcertificatebyname
    • bitsadmin setcredentials bitsadmin setcustomheaders bitsadmin

    • setdisplayname
    • bitsadmin

    • sethelpertoken
    • bitsadmin sethelpertokenflags bitsadmin

    • sethttpmethod
    • bitsadmin

    • setmaxdownloadtime
    • bitsadmin

    • setminretrydelay
    • bitsadmin
    • setnoprogresstimeout
    • bitsadmin setnotifycmdline bitsadmin

    • setnotifyflags
    • bitsadmin setpeercachingflags bitsadmin setpriority bitsadmin

    • setproxysettings
    • bitsadmin

    • setreplyfilename
    • bitsadmin

    • setsecurityflags
    • bitsadmin

    • setvalidationstate
    • bitsadmin suspend bitsadmin

    • takeownership
    • bitsadmin transfer bitsadmin util bitsadmin

      • util y enableanalyticchannel
      • bitsadmin util and getieproxy bitsadmin util and help bitsadmin util and repairservice bitsadmin util

      • and setieproxy
      • bitsadmin

      • util and version
    • bitsadmin
  • wrap bootcfg bootcfg addsw bootcfg copy bootcfg

    • dbg1394
    • bootcfg

    • debugging
    • bootcfg default bootcfg remove bootcfg ems bootcfg query bootcfg

    • raw bootcfg
    • rmsw
    • bootcfg
    • timeout
  • break

C

  • cacls
  • call
  • cd
  • certreq certutil
  • change change

    • logon
    • change change user

  • chcp chdir
  • chglogon chgport
  • chgusr
  • chkdsk
  • chkntfs
  • choice

  • cipher
  • clean
  • cleanmgr
  • clip
  • cls
  • cmd
  • cmdkey

  • cmstp
  • color
  • comp
  • compact

  • compact vdisk
  • convert

    • basic
    • convert dynamic convert

    • gpt convert
    • mbr
  • copy
  • create create partition efi create partition

  • extended create
    • partition logical
    • create partition

    • msr create partition
    • primary create volume

    • mirroring
    • create raid

    • volume create volume volume create

    • simple volume create
    • volume stripe
  • cscript

D

  • date
  • dcgpofix
  • defragment
  • delete delete disk delete partition delete

    • shadows
    • delete volume
  • detach
  • vdisk detail detail disk detail

    • detail Partition
    • Detail

    • vdisk Detail Volume
  • dfsdiag dfsdiag

  • testdcs dfsdiag testdfsconfig dfsdiag testdfsintegrity dfsdiag testreferral dfsdiag
    • testsites dfsrmig
  • diantz
  • dir
  • diskcomp
  • diskcopy diskpart
  • diskperf
  • diskraid
  • diskshadow
  • dispdiag
  • dnscmd
  • doskey
  • driverquery

E

  • echo
  • edit
  • endlocal
  • end restore
  • erase eventcreate
  • Evntcmd
  • exec
  • exit
  • expand

  • expand
  • vdisk
  • expose
  • extend
  • extract

F

  • fc
  • filesystems
  • find
  • findstr
  • finger
  • flattemp
  • fondue
  • for
  • forfiles
  • format
  • freedisk
  • fsutil

    • fsutil 8dot3name
    • Behavior of
    • fsutil fsutil file fsutil dirty fsutil fsinfo fsutil hardlink fsutil objectid fsutil quota fsutil repair fsutil reparsepoint fsutil resource fsutil sparse fsutil tiering fsutil transaction fsutil usn

    • fsutil

    • volume
    • fsutil
    • wim
  • ftp ftp

    • append
    • ftp

    • ascii
    • ftp bell ftp

    • binary
    • ftp

    • bye
    • ftp
    • cd
    • ftp close ftp

    • debug
    • ftp delete ftp dir ftp

    • disconnect ftp get
    • ftp

    • glob
    • ftp hash lcd ftp

    • literal
    • ftp ls ftp

    • mget ftp mkdir
    • ftp

    • mls
    • ftp

    • mput ftp open
    • ftp

    • indicator
    • put
    • ftp

    • pwd
    • ftp exit ftp quote ftp

    • recv
    • ftp remotehelp
    • ftp

    • rename
    • ftp rmdir
    • ftp send
    • ftp status ftp trace ftp

    • type
    • ftp

    • user
    • ftp

    • verbose
    • ftp

    • mdelete ftp mdir
    • ftype
  • fveupdate

G

  • getmac gettype
  • goto
  • gpfixup gpresult
  • gpt gpupdate
  • graftabl

H

  • help
  • helpctr
  • hostname

I

  • icacls
  • if
  • import (shadowdisk
  • )

  • import (diskpart)
  • inactive
  • ipconfig ipxroute
  • irftp

J

  • jetpack

K

klist ksetup ksetup addenctypeattr ksetup addhosttorealmmap ksetup addkdc ksetup addkpasswd ksetup

    addrealmflags ksetup changepassword ksetup delenctypeattr ksetup delhosttorealmmap ksetup delkdc

    • ksetup delkpasswd
    • ksetup
    • delrealmflags ksetup domain ksetup

    • dumpstate
    • ksetup getenctypeattr ksetup listrealmflags ksetup

    • mapuser
    • ksetup removerealm ksetup server ksetup

    • setcomputerpassword ksetup setenctypeattr
    • ksetup

    • setrealm ksetup setrealmflags
  • ktmutil
  • ktpass

l

  • label list
    • providers list
    • shadows list
    • list Writers
  • load metadata
  • lodctr
  • logman logman create logman create alert logman create api logman create cfg logman create counter logman create trace logman delete logman import and logman export logman query logman start and logman stop logman update logman update alert logman update

    • api

    • logman
    • update
    • cfg
    • logman
    • update

    • counter
    • logman update trace logoff
  • lpq lpr
  • M

macfile makecab manage bde manage bde status manage bde on manage bde off manage bde pause manage bde resume manage bde lock manage bde lock manage bde

  • unlock manage bde autounlock manage bde protectors manage bde tpm manage bde

    • setidentifier
    • manage

    • bde
    • forcerecovery manage

    • bde
    • forcerecovery
    • manage bde changepassword manage bde

    • changepin
    • manage bde changekey manage bde keypackage manage bde

    • keypackage
    • manage

    • bde
    • update

    • manage bde
    • wipefreespace
  • mapadmin
  • md
  • merge vdisk
  • mkdir mklink

  • mmc
  • mode
  • more
  • mount
  • mountvol
  • move
  • mqbkup mqsvc

  • mqtgsvc
  • msdt
  • msg

  • msiexec
  • msinfo32
  • mstsc
  • n

  • nbtstat

  • netcfg
  • netdom
  • net print
  • netsh netstat
  • nfsadmin nfsshare

  • nfsstat
  • nlbmgr
  • nltest
  • nslookup nslookup exit Command nslookup finger Command nslookup help nslookup ls nslookup lserver nslookup root nslookup

  • Server nslookup set nslookup set

  • all
    • nslookup set class nslookup set d2 nslookup set

    • debug
    • nslookup set domain nslookup set port nslookup set querytype nslookup set recurse nslookup set retry nslookup set root nslookup set search

    • nslookup set
    • srchlist
    • nslookup set timeout nslookup set type nslookup

    • set vc nslookup
    • view
  • ntbackup
  • ntcmdprompt
  • ntfrsutl

O

offline disk

    • offline
    • volume online

    • disk

  • online

    • volume
    • openfiles

P

  • pagefileconfig
  • path
  • pathping
  • pause
  • pbadmin pentnt
  • perfmon

  • ping
  • pktmon
  • pnpunattend pnputil

  • popd
  • PowerShell

  • PowerShell
  • ise
  • print
  • prncnfg
  • prndrvr prnjobs
  • prnmngr
  • prnport prnqctl
  • prompt
  • pubprn
  • pushd pushprinterconnections
  • pwlauncher pwsh

Q

  • qappsrv qprocess
  • query

  • query process query
      session query

    • termserver
    • query

    • user
  • quser
  • qwinsta

R

  • rd rdpsign
  • recover

  • recover
  • disk group
  • refsutil
  • reg reg

    • reg add
    • reg compare reg

    • copy
    • reg delete reg

    • export
    • reg import reg load reg query reg restore reg

    • save
    • reg
    • unload
  • regini

  • regsvr32
  • relog rem
  • remove
  • ren
  • rename
  • repadmin
  • repair
    • repair bde
  • replace rescan
  • reset session reset

    • session
  • retain
  • revert
  • rexec
  • risetup
  • rmdir
  • robocopy
  • route ws2008
  • rpcinfo rpcping
  • rsh
  • rundll32

  • rundll32
  • printui
  • rwinsta

S

  • san
  • sc

  • config
  • sc

  • create
  • sc

  • delete
  • sc query
  • schtasks
  • scwcmd scwcmd analyze scwcmd configure scwcmd register scwcmd

    • rollback scwcmd

    • transform
    • scwcmd view
    • secedit secedit analyze secedit configure secedit export secedit generaterollback

  • secedit

    • secedit
    • import

    • secedit
    • validate
  • select select

  • disk select partition select
    • vdisk
    • select volume
  • serverceipoptin
  • servermanagercmd
  • serverweroptin
  • set

  • environment variables
  • set shadow

  • copy set
    • context
    • set

    • id
    • setlocal
    • set metadata set

    • option
    • set

    • verbose
    • setx

  • sfc
  • shadow
  • shift
  • showmount
  • shrink
  • shutdown
  • simular restore
  • sort
  • start subcommand set device subcommand set drivergroup subcommand set drivergroup subcommand set

  • drivergroupfilter subcommand set driverpackage
  • subcommand set

  • image
  • subcommand set set

  • imagegroup
  • subcommand

  • set
  • subcommand set transportserver subcommand

  • multicasttransmission
  • subcommand start

  • namespace
  • subcommand
  • start server
  • subcommand start transportserver subcommand stop

  • server
  • subcommand
  • stop

  • transportserver
  • subst
  • sxstrace
  • sysocmgr systeminfo

t

  • takeown
  • tapicfg
  • taskkill tasklist
  • tcmsetup
  • telnet telnet close telnet display

  • telnet open telnet exit telnet send telnet

    • set
    • telnet
    • state
    • telnet unset
  • tftp
  • timeout
  • title
  • tlntadmn
  • tpmtool tpmvscmgr
  • tracerpt
  • tracert
  • tree
  • tscon tsdiscon tsecimp
  • tskill
  • tsprof
  • type

  • typeperf
  • tzutil

U

  • unexpose
  • uniqueid
  • unlodctr

V

ver verifier verify vol vssadmin vssadmin delete shadows vssadmin list shadows vssadmin

    • list writers
    • vssadmin resize shadowstorage

W

waitfor wbadmin wbadmin delete catalog wbadmin

    • delete systemstatebackup
    • wbadmin

    • disable
    • backup

    • wbadmin
    • enable
    • backup

    • wbadmin get wbadmin disks get wbadmin items get wbadmin status get wbadmin versions restore wbadmin catalog start wbadmin backup start wbadmin recovery start sysrecovery wbadmin start systemstatebackup

    • wbadmin start systemstaterecovery
    • wbadmin stop
    • wdsutil
    • job
  • wecutil
  • wevtutil
  • where
  • whoami
  • winnt
  • winnt32
  • winrs
  • winsat

  • mem winsat
  • mfmedia
  • wmic
  • writer
  • wscript

x

  • xcopy