0% found this document useful (0 votes)
39 views39 pages

DOS Command Index Overview

This document provides a summary and index of common DOS commands, including brief descriptions of what each command does and basic syntax. It lists commands such as ASSOC, ATTRIB, BREAK, BCDEDIT, and others with 1-3 sentences explaining the purpose and basic usage of each command.

Uploaded by

Ranjit Kumar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views39 pages

DOS Command Index Overview

This document provides a summary and index of common DOS commands, including brief descriptions of what each command does and basic syntax. It lists commands such as ASSOC, ATTRIB, BREAK, BCDEDIT, and others with 1-3 sentences explaining the purpose and basic usage of each command.

Uploaded by

Ranjit Kumar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

7/28/2015

DOSCommandIndex

DOSCommandIndex
WindowsVersion : MicrosoftWindows[Version6.1.7601]
DocumentSource :

[Link]
[Link]

Createdby

[Link]
SourceCodebelow

ASSOC
Displaysormodifiesfileextensionassociations.
ATTRIB
Displaysorchangesfileattributes.
BREAK
SetsorclearsextendedCTRL+Cchecking.
BCDEDIT
Setspropertiesinbootdatabasetocontrolbootloading.
CACLS
Displaysormodifiesaccesscontrollists(ACLs)offiles.
CALL
Callsonebatchprogramfromanother.
CD
Displaysthenameoforchangesthecurrentdirectory.
CHCP
Displaysorsetstheactivecodepagenumber.
CHDIR
Displaysthenameoforchangesthecurrentdirectory.
CHKDSK
Checksadiskanddisplaysastatusreport.
CHKNTFS
Displaysormodifiesthecheckingofdiskatboottime.
CLS
Clearsthescreen.
CMD
StartsanewinstanceoftheWindowscommandinterpreter.
COLOR
Setsthedefaultconsoleforegroundandbackgroundcolors.
COMP
Comparesthecontentsoftwofilesorsetsoffiles.
COMPACT
DisplaysoraltersthecompressionoffilesonNTFSpartitions.
CONVERT
[Link]
COPY
Copiesoneormorefilestoanotherlocation.
DATE
Displaysorsetsthedate.
DEL
Deletesoneormorefiles.
DIR
Displaysalistoffilesandsubdirectoriesinadirectory.
DISKCOMP
Comparesthecontentsoftwofloppydisks.
DISKCOPY
Copiesthecontentsofonefloppydisktoanother.
DISKPART
DisplaysorconfiguresDiskPartitionproperties.
DOSKEY
Editscommandlines,recallsWindowscommands,and
DRIVERQUERY Displayscurrentdevicedriverstatusandproperties.
ECHO
Displaysmessages,orturnscommandechoingonoroff.
ENDLOCAL
Endslocalizationofenvironmentchangesinabatchfile.
ERASE
Deletesoneormorefiles.
EXIT
[Link](commandinterpreter).
FC
Comparestwofilesorsetsoffiles,anddisplaysthe
FIND
Searchesforatextstringinafileorfiles.
FINDSTR
Searchesforstringsinfiles.
FOR
Runsaspecifiedcommandforeachfileinasetoffiles.
FORMAT
FormatsadiskforusewithWindows.
FSUTIL
Displaysorconfiguresthefilesystemproperties.
FTYPE
Displaysormodifiesfiletypesusedinfileextension
GOTO
DirectstheWindowscommandinterpretertoalabeledlinein
GPRESULT
DisplaysGroupPolicyinformationformachineoruser.
GRAFTABL
EnablesWindowstodisplayanextendedcharactersetin
HELP
ProvidesHelpinformationforWindowscommands.
ICACLS
Display,modify,backup,orrestoreACLsforfilesand
IF
Performsconditionalprocessinginbatchprograms.
LABEL
Creates,changes,ordeletesthevolumelabelofadisk.
MD
Createsadirectory.
MKDIR
Createsadirectory.
MKLINK
CreatesSymbolicLinksandHardLinks
MODE
Configuresasystemdevice.
MORE
Displaysoutputonescreenatatime.
MOVE
Movesoneormorefilesfromonedirectorytoanother
OPENFILES
Displaysfilesopenedbyremoteusersforafileshare.
PATH
Displaysorsetsasearchpathforexecutablefiles.
PAUSE
Suspendsprocessingofabatchfileanddisplaysamessage.
POPD
Restoresthepreviousvalueofthecurrentdirectorysavedby
PRINT
Printsatextfile.
PROMPT
ChangestheWindowscommandprompt.
PUSHD
Savesthecurrentdirectorythenchangesit.
RD
Removesadirectory.
RECOVER
Recoversreadableinformationfromabadordefectivedisk.
[Link]

1/39

7/28/2015

DOSCommandIndex

REM
REN
RENAME
REPLACE
RMDIR
ROBOCOPY
SET
SETLOCAL
SHIFT
SHUTDOWN
SORT
START
SUBST
SYSTEMINFO
TASKLIST
TASKKILL
TIME
TITLE
TREE
TYPE
VER
VERIFY
VOL
XCOPY
WMIC

Recordscomments(remarks)[Link].
Renamesafileorfiles.
Renamesafileorfiles.
Replacesfiles.
Removesadirectory.
Advancedutilitytocopyfilesanddirectorytrees
Displays,sets,orremovesWindowsenvironmentvariables.
Beginslocalizationofenvironmentchangesinabatchfile.
Shiftsthepositionofreplaceableparametersinbatchfiles.
Allowsproperlocalorremoteshutdownofmachine.
Sortsinput.
Startsaseparatewindowtorunaspecifiedprogramorcommand.
Associatesapathwithadriveletter.
Displaysmachinespecificpropertiesandconfiguration.
Displaysallcurrentlyrunningtasksincludingservices.
Killorstoparunningprocessorapplication.
Displaysorsetsthesystemtime.
[Link].
Graphicallydisplaysthedirectorystructureofadriveor
Displaysthecontentsofatextfile.
DisplaystheWindowsversion.
TellsWindowswhethertoverifythatyourfilesarewritten
Displaysadiskvolumelabelandserialnumber.
Copiesfilesanddirectorytrees.
DisplaysWMIinformationinsideinteractivecommandshell.
TOP

ASSOC
Displaysormodifiesfileextensionassociations
ASSOC[.ext[=[fileType]]]
.extSpecifiesthefileextensiontoassociatethefiletypewith
fileTypeSpecifiesthefiletypetoassociatewiththefileextension
TypeASSOCwithoutparameterstodisplaythecurrentfileassociations.
IfASSOCisinvokedwithjustafileextension,itdisplaysthecurrent
[Link]
typeandthecommandwilldeletetheassociationforthefileextension.

ATTRIB

TOP

BREAK

TOP

Displaysorchangesfileattributes.
ATTRIB[+R|R][+A|A][+S|S][+H|H][+I|I]
[drive:][path][filename][/S[/D][/L]]
+Setsanattribute.
Clearsanattribute.
RReadonlyfileattribute.
AArchivefileattribute.
SSystemfileattribute.
HHiddenfileattribute.
INotcontentindexedfileattribute.
[drive:][path][filename]
Specifiesafileorfilesforattribtoprocess.
/SProcessesmatchingfilesinthecurrentfolder
andallsubfolders.
/DProcessesfoldersaswell.
/LWorkontheattributesoftheSymbolicLinkversus
thetargetoftheSymbolicLink

SetsorClearsExtendedCTRL+CcheckingonDOSsystem
[Link]
underWindows.
IfCommandExtensionsareenabled,andrunningontheWindows
platform,thentheBREAKcommandwillenterahardcodedbreakpoint
ifbeingdebuggedbyadebugger.

TOP
[Link]

2/39

7/28/2015

DOSCommandIndex

BCDEDIT
BCDEDITBootConfigurationDataStoreEditor
[Link].
Thebootconfigurationdatastorecontainsbootconfigurationparametersand
[Link]
[Link](inBIOSbasedoperatingsystems)orinthenonvolatile
RAMentries(inExtensibleFirmwareInterfacebasedoperatingsystems).Youcan
[Link],delete,edit,andappendentriesintheboot
configurationdatastore.
Fordetailedcommandandoptioninformation,[Link]/?<command>.For
example,todisplaydetailedinformationaboutthe/createstorecommand,type:
[Link]/?/createstore
Foranalphabeticallistoftopicsinthishelpfile,run"bcdedit/?TOPICS".
Commandsthatoperateonastore
================================
/createstoreCreatesanewandemptybootconfigurationdatastore.
/[Link]
canbeusedlatertorestorethestateofthesystemstore.
/importRestoresthestateofthesystemstoreusingabackupfile
createdwiththe/exportcommand.
/sysstoreSetsthesystemstoredevice(onlyaffectsEFIsystems,does
notpersistacrossreboots,andisonlyusedincaseswhere
thesystemstoredeviceisambiguous).
Commandsthatoperateonentriesinastore
===========================================
/copyMakescopiesofentriesinthestore.
/createCreatesnewentriesinthestore.
/deleteDeletesentriesfromthestore.
/mirrorCreatesmirrorofentriesinthestore.
Runbcdedit/?IDforinformationaboutidentifiersusedbythesecommands.
Commandsthatoperateonentryoptions
======================================
/deletevalueDeletesentryoptionsfromthestore.
/setSetsentryoptionvaluesinthestore.
Runbcdedit/?TYPESforalistofdatatypesusedbythesecommands.
Runbcdedit/?FORMATSforalistofvaliddataformats.
Commandsthatcontroloutput
============================
/enumListsentriesinthestore.
/vCommandlineoptionthatdisplaysentryidentifiersinfull,
ratherthanusingnamesforwellknownidentifiers.
Use/vbyitselfasacommandtodisplayentryidentifiers
infullfortheACTIVEtype.
Running"bcdedit"byitselfisequivalenttorunning"bcdedit/enumACTIVE".
Commandsthatcontrolthebootmanager
======================================
/bootsequenceSetstheonetimebootsequenceforthebootmanager.
/defaultSetsthedefaultentrythatthebootmanagerwilluse.
/displayorderSetstheorderinwhichthebootmanagerdisplaysthe
multibootmenu.
/timeoutSetsthebootmanagertimeoutvalue.
/toolsdisplayorderSetstheorderinwhichthebootmanagerdisplays
thetoolsmenu.
CommandsthatcontrolEmergencyManagementServicesforabootapplication
==========================================================================
/bootemsEnablesordisablesEmergencyManagementServices
forabootapplication.
/emsEnablesordisablesEmergencyManagementServicesforan
operatingsystementry.
/emssettingsSetstheglobalEmergencyManagementServicesparameters.
Commandthatcontroldebugging
==============================
/bootdebugEnablesordisablesbootdebuggingforabootapplication.
/dbgsettingsSetstheglobaldebuggerparameters.
/debugEnablesordisableskerneldebuggingforanoperatingsystem
entry.
/hypervisorsettingsSetsthehypervisorparameters.

CACLS

TOP

NOTE:Caclsisnowdeprecated,pleaseuseIcacls.

Displaysormodifiesaccesscontrollists(ACLs)offiles

[Link]

3/39

7/28/2015

DOSCommandIndex

CACLSfilename[/T][/M][/L][/S[:SDDL]][/E][/C][/Guser:perm]
[/Ruser[...]][/Puser:perm[...]][/Duser[...]]
filenameDisplaysACLs.
/TChangesACLsofspecifiedfilesin
thecurrentdirectoryandallsubdirectories.
/LWorkontheSymbolicLinkitselfversusthetarget
/MChangesACLsofvolumesmountedtoadirectory
/SDisplaystheSDDLstringfortheDACL.
/S:SDDLReplacestheACLswiththosespecifiedintheSDDLstring
(notvalidwith/E,/G,/R,/P,or/D).
/EEditACLinsteadofreplacingit.
/CContinueonaccessdeniederrors.
/Guser:permGrantspecifieduseraccessrights.
Permcanbe:RRead
WWrite
CChange(write)
FFullcontrol
/RuserRevokespecifieduser'saccessrights(onlyvalidwith/E).
/Puser:permReplacespecifieduser'saccessrights.
Permcanbe:NNone
RRead
WWrite
CChange(write)
FFullcontrol
/DuserDenyspecifieduseraccess.
Wildcardscanbeusedtospecifymorethanonefileinacommand.
Youcanspecifymorethanoneuserinacommand.

Abbreviations:
CIContainerInherit.
TheACEwillbeinheritedbydirectories.
OIObjectInherit.
TheACEwillbeinheritedbyfiles.
IOInheritOnly.
TheACEdoesnotapplytothecurrentfile/directory.
IDInherited.
TheACEwasinheritedfromtheparentdirectory'sACL.

CALL

TOP

Callsonebatchprogramfromanother.
CALL[drive:][path]filename[batchparameters]
batchparametersSpecifiesanycommandlineinformationrequiredbythe
batchprogram.
IfCommandExtensionsareenabledCALLchangesasfollows:
[Link]
is:
CALL:labelarguments
Anewbatchfilecontextiscreatedwiththespecifiedargumentsand
[Link]
"exit"[Link]
firsttimeyoureadtheend,controlwillreturntojustaftertheCALL
[Link]/?
foradescriptionoftheGOTO:EOFextensionthatwillallowyouto

[Link]

4/39

7/28/2015

DOSCommandIndex

"return"fromabatchscript.
Inaddition,expansionofbatchscriptargumentreferences(%0,%1,
etc.)havebeenchangedasfollows:
%*inabatchscriptreferstoallthearguments(e.g.%1%2%3
%4%5...)
Substitutionofbatchparameters(%n)[Link]
nowusethefollowingoptionalsyntax:
%~1expands%1removinganysurroundingquotes(")
%~f1expands%1toafullyqualifiedpathname
%~d1expands%1toadriveletteronly
%~p1expands%1toapathonly
%~n1expands%1toafilenameonly
%~x1expands%1toafileextensiononly
%~s1expandedpathcontainsshortnamesonly
%~a1expands%1tofileattributes
%~t1expands%1todate/timeoffile
%~z1expands%1tosizeoffile
%~$PATH:1searchesthedirectorieslistedinthePATH
environmentvariableandexpands%1tothefully
[Link]
environmentvariablenameisnotdefinedorthe
fileisnotfoundbythesearch,thenthis
modifierexpandstotheemptystring
Themodifierscanbecombinedtogetcompoundresults:
%~dp1expands%1toadriveletterandpathonly
%~nx1expands%1toafilenameandextensiononly
%~dp$PATH:1searchesthedirectorieslistedinthePATH
environmentvariablefor%1andexpandstothe
driveletterandpathofthefirstonefound.
%~ftza1expands%1toaDIRlikeoutputline
Intheaboveexamples%1andPATHcanbereplacedbyother
[Link]%~syntaxisterminatedbyavalidargument
[Link]%~modifiersmaynotbeusedwith%*

CD

TOP

Displaysthenameoforchangesthecurrentdirectory.
CHDIR[/D][drive:][path]
CHDIR[..]
CD[/D][drive:][path]
CD[..]
..Specifiesthatyouwanttochangetotheparentdirectory.
TypeCDdrive:todisplaythecurrentdirectoryinthespecifieddrive.
TypeCDwithoutparameterstodisplaythecurrentdriveanddirectory.
Usethe/Dswitchtochangecurrentdriveinadditiontochangingcurrent
directoryforadrive.
IfCommandExtensionsareenabledCHDIRchangesasfollows:
Thecurrentdirectorystringisconvertedtousethesamecaseas
[Link]:\TEMPwouldactuallysetthecurrent
directorytoC:\Tempifthatisthecaseondisk.
CHDIRcommanddoesnottreatspacesasdelimiters,soitispossibleto
CDintoasubdirectorynamethatcontainsaspacewithoutsurrounding
[Link]:
cd\winnt\profiles\username\programs\startmenu
isthesameas:
cd"\winnt\profiles\username\programs\startmenu"
whichiswhatyouwouldhavetotypeifextensionsweredisabled.

CHCP

TOP

Displaysorsetstheactivecodepagenumber.
CHCP[nnn]
nnnSpecifiesacodepagenumber.
TypeCHCPwithoutaparametertodisplaytheactivecodepagenumber.

CHDIR
[Link]

TOP

5/39

7/28/2015

DOSCommandIndex

Displaysthenameoforchangesthecurrentdirectory.
CHDIR[/D][drive:][path]
CHDIR[..]
CD[/D][drive:][path]
CD[..]
..Specifiesthatyouwanttochangetotheparentdirectory.
TypeCDdrive:todisplaythecurrentdirectoryinthespecifieddrive.
TypeCDwithoutparameterstodisplaythecurrentdriveanddirectory.
Usethe/Dswitchtochangecurrentdriveinadditiontochangingcurrent
directoryforadrive.
IfCommandExtensionsareenabledCHDIRchangesasfollows:
Thecurrentdirectorystringisconvertedtousethesamecaseas
[Link]:\TEMPwouldactuallysetthecurrent
directorytoC:\Tempifthatisthecaseondisk.
CHDIRcommanddoesnottreatspacesasdelimiters,soitispossibleto
CDintoasubdirectorynamethatcontainsaspacewithoutsurrounding
[Link]:
cd\winnt\profiles\username\programs\startmenu
isthesameas:
cd"\winnt\profiles\username\programs\startmenu"
whichiswhatyouwouldhavetotypeifextensionsweredisabled.

CHKDSK

TOP

Checksadiskanddisplaysastatusreport.
CHKDSK[volume[[path]filename]]][/F][/V][/R][/X][/I][/C][/L[:size]][/B]
volumeSpecifiesthedriveletter(followedbyacolon),
mountpoint,orvolumename.
filenameFAT/FAT32only:Specifiesthefilestocheckforfragmentation.
/FFixeserrorsonthedisk.
/VOnFAT/FAT32:Displaysthefullpathandnameofeveryfile
onthedisk.
OnNTFS:Displayscleanupmessagesifany.
/RLocatesbadsectorsandrecoversreadableinformation
(implies/F).
/L:sizeNTFSonly:Changesthelogfilesizetothespecifiednumber
[Link],displayscurrent
size.
/XForcesthevolumetodismountfirstifnecessary.
Allopenedhandlestothevolumewouldthenbeinvalid
(implies/F).
/INTFSonly:Performsalessvigorouscheckofindexentries.
/CNTFSonly:Skipscheckingofcycleswithinthefolder
structure.
/BNTFSonly:Reevaluatesbadclustersonthevolume
(implies/R)
The/Ior/CswitchreducestheamountoftimerequiredtorunChkdskby
skippingcertainchecksofthevolume.

CHKNTFS

TOP

Displaysormodifiesthecheckingofdiskatboottime.
CHKNTFSvolume[...]
CHKNTFS/D
CHKNTFS/T[:time]
CHKNTFS/Xvolume[...]
CHKNTFS/Cvolume[...]
volumeSpecifiesthedriveletter(followedbyacolon),
mountpoint,orvolumename.
/DRestoresthemachinetothedefaultbehavior;alldrivesare
checkedatboottimeandchkdskisrunonthosethatare
dirty.
/T:timeChangestheAUTOCHKinitiationcountdowntimetothe
[Link]
specified,displaysthecurrentsetting.
/[Link]
drivesarenotaccumulatedbetweencommandinvocations.
/CSchedulesadrivetobecheckedatboottime;chkdskwillrun
ifthedriveisdirty.
Ifnoswitchesarespecified,CHKNTFSwilldisplayifthespecifieddriveis
dirtyorscheduledtobecheckedonnextreboot.

TOP
[Link]

6/39

7/28/2015

DOSCommandIndex

CLS
Clearsthescreen.
CLS

CMD

TOP

StartsanewinstanceoftheWindowscommandinterpreter
CMD[/A|/U][/Q][/D][/E:ON|/E:OFF][/F:ON|/F:OFF][/V:ON|/V:OFF]
[[/S][/C|/K]string]
/CCarriesoutthecommandspecifiedbystringandthenterminates
/KCarriesoutthecommandspecifiedbystringbutremains
/SModifiesthetreatmentofstringafter/Cor/K(seebelow)
/QTurnsechooff
/DDisableexecutionofAutoRuncommandsfromregistry(seebelow)
/ACausestheoutputofinternalcommandstoapipeorfiletobeANSI
/UCausestheoutputofinternalcommandstoapipeorfiletobe
Unicode
/T:fgSetstheforeground/backgroundcolors(seeCOLOR/?formoreinfo)
/E:ONEnablecommandextensions(seebelow)
/E:OFFDisablecommandextensions(seebelow)
/F:ONEnablefileanddirectorynamecompletioncharacters(seebelow)
/F:OFFDisablefileanddirectorynamecompletioncharacters(seebelow)
/V:ONEnabledelayedenvironmentvariableexpansionusing!asthe
[Link],/V:ONwouldallow!var!toexpandthe
[Link]
atinputtime,whichisquiteadifferentthingwheninsideofaFOR
loop.
/V:OFFDisabledelayedenvironmentexpansion.
Notethatmultiplecommandsseparatedbythecommandseparator'&&'
[Link],forcompatibility
reasons,/Xisthesameas/E:ON,/Yisthesameas/E:OFFand/Risthe
sameas/[Link].
If/Cor/Kisspecified,thentheremainderofthecommandlineafter
theswitchisprocessedasacommandline,wherethefollowinglogicis
usedtoprocessquote(")characters:
[Link],thenquotecharacters
onthecommandlinearepreserved:
no/Sswitch
exactlytwoquotecharacters
nospecialcharactersbetweenthetwoquotecharacters,
wherespecialisoneof:&<>()@^|
thereareoneormorewhitespacecharactersbetweenthe
twoquotecharacters
thestringbetweenthetwoquotecharactersisthename
ofanexecutablefile.
[Link],oldbehavioristoseeifthefirstcharacteris
aquotecharacterandifso,striptheleadingcharacterand
removethelastquotecharacteronthecommandline,preserving
anytextafterthelastquotecharacter.
If/DwasNOTspecifiedonthecommandline,[Link],it
looksforthefollowingREG_SZ/REG_EXPAND_SZregistryvariables,andif
eitherorbotharepresent,theyareexecutedfirst.
HKEY_LOCAL_MACHINE\Software\Microsoft\CommandProcessor\AutoRun
and/or
HKEY_CURRENT_USER\Software\Microsoft\CommandProcessor\AutoRun
[Link]
extensionsforaparticularinvocationbyusingthe/E:[Link]
[Link]
machineand/oruserlogonsessionbysettingeitherorbothofthe
followingREG_DWORDvaluesintheregistryusingREGEDIT.EXE:
HKEY_LOCAL_MACHINE\Software\Microsoft\CommandProcessor\EnableExtensions
and/or
HKEY_CURRENT_USER\Software\Microsoft\CommandProcessor\EnableExtensions
[Link]
[Link]
registrysettings.
Inabatchfile,theSETLOCALENABLEEXTENSIONSorDISABLEEXTENSIONSarguments
takesprecedenceoverthe/E:ONor/E:[Link]/?fordetails.
Thecommandextensionsinvolvechangesand/oradditionstothefollowing
commands:
DELorERASE
COLOR
CDorCHDIR
MDorMKDIR
PROMPT

[Link]

7/39

7/28/2015

DOSCommandIndex

PUSHD
POPD
SET
SETLOCAL
ENDLOCAL
IF
FOR
CALL
SHIFT
GOTO
START(alsoincludeschangestoexternalcommandinvocation)
ASSOC
FTYPE
Togetspecificdetails,typecommandname/?toviewthespecifics.
[Link]
canenableordisabledelayedenvironmentvariableexpansionfora
[Link]/V:ONor/V:[Link]
[Link]
machineand/oruserlogonsessionbysettingeitherorbothofthe
followingREG_DWORDvaluesintheregistryusingREGEDIT.EXE:
HKEY_LOCAL_MACHINE\Software\Microsoft\CommandProcessor\DelayedExpansion
and/or
HKEY_CURRENT_USER\Software\Microsoft\CommandProcessor\DelayedExpansion
[Link]
[Link]
registrysettings.
InabatchfiletheSETLOCALENABLEDELAYEDEXPANSIONorDISABLEDELAYEDEXPANSION
argumentstakesprecedenceoverthe/V:ONor/V:[Link]/?
fordetails.
Ifdelayedenvironmentvariableexpansionisenabled,thentheexclamation
charactercanbeusedtosubstitutethevalueofanenvironmentvariable
atexecutiontime.
Youcanenableordisablefilenamecompletionforaparticular
[Link]/F:ONor/F:[Link]
[Link]/or
userlogonsessionbysettingeitherorbothofthefollowingREG_DWORD
[Link]:
HKEY_LOCAL_MACHINE\Software\Microsoft\CommandProcessor\CompletionChar
HKEY_LOCAL_MACHINE\Software\Microsoft\CommandProcessor\PathCompletionChar
and/or
HKEY_CURRENT_USER\Software\Microsoft\CommandProcessor\CompletionChar
HKEY_CURRENT_USER\Software\Microsoft\CommandProcessor\PathCompletionChar
withthehexvalueofacontrolcharactertouseforaparticular
function(e.g.0x4isCtrlDand0x6isCtrlF).Theuserspecific
[Link]
switchestakeprecedenceovertheregistrysettings.
Ifcompletionisenabledwiththe/F:ONswitch,thetwocontrol
charactersusedareCtrlDfordirectorynamecompletionandCtrlFfor
[Link]
theregistry,usethevalueforspace(0x20)asitisnotavalid
controlcharacter.
Completionisinvokedwhenyoutypeeitherofthetwocontrol
[Link]
ofthecursorappendsawildcardcharactertoitifnoneisalready
[Link]
[Link],itjustbeepsandleavesthe
[Link],repeatedpressingofthesamecontrol
[Link]
Shiftkeywiththecontrolcharacterwillmovethroughthelist
[Link]
characteragain,thesavedlistofmatchingpathsisdiscardedandanew
[Link]
[Link]
isthefilecompletioncharactermatchesbothfileanddirectorynames,
whilethedirectorycompletioncharacteronlymatchesdirectorynames.
Iffilecompletionisusedonanyofthebuiltindirectorycommands
(CD,MDorRD)thendirectorycompletionisassumed.
Thecompletioncodedealscorrectlywithfilenamesthatcontainspaces
orotherspecialcharactersbyplacingquotesaroundthematchingpath.
Also,ifyoubackup,theninvokecompletionfromwithinaline,the
texttotherightofthecursoratthepointcompletionwasinvokedis
discarded.
Thespecialcharactersthatrequirequotesare:
<space>
&()[]{}^=;!'+,`~

COLOR

TOP

Setsthedefaultconsoleforegroundandbackgroundcolors.
COLOR[attr]

[Link]

8/39

7/28/2015

DOSCommandIndex

attrSpecifiescolorattributeofconsoleoutput
ColorattributesarespecifiedbyTWOhexdigitsthefirst
correspondstothebackground;[Link]
canbeanyofthefollowingvalues:
0=Black8=Gray
1=Blue9=LightBlue
2=GreenA=LightGreen
3=AquaB=LightAqua
4=RedC=LightRed
5=PurpleD=LightPurple
6=YellowE=LightYellow
7=WhiteF=BrightWhite
Ifnoargumentisgiven,thiscommandrestoresthecolortowhatitwas
[Link]
window,the/TcommandlineswitchorfromtheDefaultColorregistry
value.
TheCOLORcommandsetsERRORLEVELto1ifanattemptismadetoexecute
theCOLORcommandwithaforegroundandbackgroundcolorthatarethe
same.
Example:"COLORfc"produceslightredonbrightwhite

COMP

TOP

Comparesthecontentsoftwofilesorsetsoffiles.
COMP[data1][data2][/D][/A][/L][/N=number][/C][/OFF[LINE]]
data1Specifieslocationandname(s)offirstfile(s)tocompare.
data2Specifieslocationandname(s)ofsecondfilestocompare.
/DDisplaysdifferencesindecimalformat.
/ADisplaysdifferencesinASCIIcharacters.
/LDisplayslinenumbersfordifferences.
/N=numberComparesonlythefirstspecifiednumberoflinesineachfile.
/CDisregardscaseofASCIIletterswhencomparingfiles.
/OFF[LINE]Donotskipfileswithofflineattributeset.
Tocomparesetsoffiles,usewildcardsindata1anddata2parameters.

COMPACT

TOP

DisplaysoraltersthecompressionoffilesonNTFSpartitions.
COMPACT[/C|/U][/S[:dir]][/A][/I][/F][/Q][filename[...]]
/[Link]
sothatfilesaddedafterwardwillbecompressed.
/[Link]
sothatfilesaddedafterwardwillnotbecompressed.
/SPerformsthespecifiedoperationonfilesinthegiven
[Link]"dir"isthe
currentdirectory.
/[Link]
filesareomittedbydefault.
/IContinuesperformingthespecifiedoperationevenaftererrors
[Link],COMPACTstopswhenanerroris
encountered.
/FForcesthecompressoperationonallspecifiedfiles,even
[Link]
areskippedbydefault.
/QReportsonlythemostessentialinformation.
filenameSpecifiesapattern,file,ordirectory.
Usedwithoutparameters,COMPACTdisplaysthecompressionstateof
[Link]
[Link]
parameters.

CONVERT

TOP

ConvertsaFATvolumetoNTFS.
CONVERTvolume/FS:NTFS[/V][/CvtArea:filename][/NoSecurity][/X]
volumeSpecifiesthedriveletter(followedbyacolon),
mountpoint,orvolumename.
/FS:NTFSSpecifiesthatthevolumewillbeconvertedtoNTFS.
/VSpecifiesthatConvertwillberuninverbosemode.
/CvtArea:filename
Specifiesacontiguousfileintherootdirectory
thatwillbetheplaceholderforNTFSsystemfiles.
/NoSecuritySpecifiesthatthesecuritysettingsontheconverted
filesanddirectoriesallowaccessbyallusers.

[Link]

9/39

7/28/2015

DOSCommandIndex

/XForcesthevolumetodismountfirstifnecessary.
Allopenhandlestothevolumewillnotbevalid.

COPY

TOP

Copiesoneormorefilestoanotherlocation.
COPY[/D][/V][/N][/Y|/Y][/Z][/L][/A|/B]source[/A|/B]
[+source[/A|/B][+...]][destination[/A|/B]]
sourceSpecifiesthefileorfilestobecopied.
/AIndicatesanASCIItextfile.
/BIndicatesabinaryfile.
/DAllowthedestinationfiletobecreateddecrypted
destinationSpecifiesthedirectoryand/orfilenameforthenewfile(s).
/VVerifiesthatnewfilesarewrittencorrectly.
/NUsesshortfilename,ifavailable,whencopyingafilewitha
non8dot3name.
/YSuppressespromptingtoconfirmyouwanttooverwritean
existingdestinationfile.
/YCausespromptingtoconfirmyouwanttooverwritean
existingdestinationfile.
/ZCopiesnetworkedfilesinrestartablemode.
/LIfthesourceisasymboliclink,copythelinktothetarget
insteadoftheactualfilethesourcelinkpointsto.
Theswitch/YmaybepresetintheCOPYCMDenvironmentvariable.
Thismaybeoverriddenwith/[Link]
topromptonoverwritesunlessCOPYcommandisbeingexecutedfrom
withinabatchscript.
Toappendfiles,specifyasinglefilefordestination,butmultiplefiles
forsource(usingwildcardsorfile1+file2+file3format).

DATE

TOP

Displaysorsetsthedate.
DATE[/T|date]
TypeDATEwithoutparameterstodisplaythecurrentdatesettingand
[Link].
IfCommandExtensionsareenabledtheDATEcommandsupports
the/Tswitchwhichtellsthecommandtojustoutputthe
currentdate,withoutpromptingforanewdate.

DEL

TOP

Deletesoneormorefiles.
DEL[/P][/F][/S][/Q][/A[[:]attributes]]names
ERASE[/P][/F][/S][/Q][/A[[:]attributes]]names
namesSpecifiesalistofoneormorefilesordirectories.
[Link]
directoryisspecified,allfileswithinthedirectory
willbedeleted.
/PPromptsforconfirmationbeforedeletingeachfile.
/FForcedeletingofreadonlyfiles.
/SDeletespecifiedfilesfromallsubdirectories.
/QQuietmode,donotaskifoktodeleteonglobalwildcard
/ASelectsfilestodeletebasedonattributes
attributesRReadonlyfilesSSystemfiles
HHiddenfilesAFilesreadyforarchiving
INotcontentindexedFilesLReparsePoints
Prefixmeaningnot
IfCommandExtensionsareenabledDELandERASEchangeasfollows:
Thedisplaysemanticsofthe/Sswitcharereversedinthatitshows
youonlythefilesthataredeleted,nottheonesitcouldnotfind.

DIR

TOP

Displaysalistoffilesandsubdirectoriesinadirectory.
DIR[drive:][path][filename][/A[[:]attributes]][/B][/C][/D][/L][/N]
[/O[[:]sortorder]][/P][/Q][/R][/S][/T[[:]timefield]][/W][/X][/4]
[drive:][path][filename]
Specifiesdrive,directory,and/orfilestolist.
/ADisplaysfileswithspecifiedattributes.

[Link]

10/39

7/28/2015

DOSCommandIndex

attributesDDirectoriesRReadonlyfiles
HHiddenfilesAFilesreadyforarchiving
SSystemfilesINotcontentindexedfiles
LReparsePointsPrefixmeaningnot
/BUsesbareformat(noheadinginformationorsummary).
/[Link]
[Link]/Ctodisabledisplayofseparator.
/DSameaswidebutfilesarelistsortedbycolumn.
/LUseslowercase.
/NNewlonglistformatwherefilenamesareonthefarright.
/OListbyfilesinsortedorder.
sortorderNByname(alphabetic)SBysize(smallestfirst)
EByextension(alphabetic)DBydate/time(oldestfirst)
GGroupdirectoriesfirstPrefixtoreverseorder
/PPausesaftereachscreenfulofinformation.
/QDisplaytheownerofthefile.
/RDisplayalternatedatastreamsofthefile.
/SDisplaysfilesinspecifieddirectoryandallsubdirectories.
/TControlswhichtimefielddisplayedorusedforsorting
timefieldCCreation
ALastAccess
WLastWritten
/WUseswidelistformat.
/XThisdisplaystheshortnamesgeneratedfornon8dot3file
[Link]/Nwiththeshortnameinserted
[Link],blanksare
displayedinitsplace.
/4Displaysfourdigityears
[Link]
presetswitchesbyprefixinganyswitchwith(hyphen)forexample,/W.

DISKCOMP

TOP

DISKCOPY

TOP

DISKPART

TOP

DOSKEY

TOP

Comparesthecontentsoftwofloppydisks.
DISKCOMP[drive1:[drive2:]]

Copiesthecontentsofonefloppydisktoanother.
DISKCOPY[drive1:[drive2:]][/V]
/VVerifiesthattheinformationiscopiedcorrectly.
Thetwofloppydisksmustbethesametype.
Youmayspecifythesamedrivefordrive1anddrive2.

Accessisdenied.

Editscommandlines,recallsWindowscommands,andcreatesmacros.
DOSKEY[/REINSTALL][/LISTSIZE=size][/MACROS[:ALL|:exename]]
[/HISTORY][/INSERT|/OVERSTRIKE][/EXENAME=exename][/MACROFILE=filename]
[macroname=[text]]
/REINSTALLInstallsanewcopyofDoskey.
/LISTSIZE=sizeSetssizeofcommandhistorybuffer.
/MACROSDisplaysallDoskeymacros.
/MACROS:ALLDisplaysallDoskeymacrosforallexecutableswhichhave
Doskeymacros.
/MACROS:exenameDisplaysallDoskeymacrosforthegivenexecutable.
/HISTORYDisplaysallcommandsstoredinmemory.
/INSERTSpecifiesthatnewtextyoutypeisinsertedinoldtext.
/OVERSTRIKESpecifiesthatnewtextoverwritesoldtext.
/EXENAME=exenameSpecifiestheexecutable.
/MACROFILE=filenameSpecifiesafileofmacrostoinstall.
macronameSpecifiesanameforamacroyoucreate.
textSpecifiescommandsyouwanttorecord.
UPandDOWNARROWSrecallcommands;ESCclearscommandline;F7displays
commandhistory;ALT+F7clearscommandhistory;F8searchescommand
history;F9selectsacommandbynumber;ALT+F10clearsmacrodefinitions.
ThefollowingaresomespecialcodesinDoskeymacrodefinitions:
$[Link].
$1$[Link]%1%9inbatchprograms.
$*Symbolreplacedbyeverythingfollowingmacronameoncommandline.

[Link]

11/39

7/28/2015

DOSCommandIndex

DRIVERQUERY

TOP

DRIVERQUERY[/Ssystem[/Uusername[/P[password]]]]
[/FOformat][/NH][/SI][/V]
Description:
Enablesanadministratortodisplayalistof
installeddevicedrivers.
ParameterList:
/SsystemSpecifiestheremotesystemtoconnectto.
/U[domain\]userSpecifiestheusercontext
underwhichthecommandshouldexecute.
/P[password]Specifythepasswordforthegiven
usercontext.
/FOformatSpecifiesthetypeofoutputtodisplay.
Validvaluestobepassedwiththe
switchare"TABLE","LIST","CSV".
/NHSpecifiesthatthe"ColumnHeader"
[Link]
"TABLE"and"CSV"formatonly.
/SIProvidesinformationaboutsigneddrivers.
/[Link]
forsigneddrivers.
/?Displaysthishelpmessage.
Examples:
DRIVERQUERY
DRIVERQUERY/FOCSV/SI
DRIVERQUERY/NH
DRIVERQUERY/Sipaddress/Uuser/V
DRIVERQUERY/Ssystem/Udomain\user/Ppassword/FOLIST

ECHO

TOP

ENDLOCAL

TOP

Displaysmessages,orturnscommandechoingonoroff.
ECHO[ON|OFF]
ECHO[message]
TypeECHOwithoutparameterstodisplaythecurrentechosetting.

Endslocalizationofenvironmentchangesinabatchfile.
EnvironmentchangesmadeafterENDLOCALhasbeenissuedare
notlocaltothebatchfile;theprevioussettingsarenot
restoredonterminationofthebatchfile.
ENDLOCAL
IfCommandExtensionsareenabledENDLOCALchangesasfollows:
IfthecorrespondingSETLOCALenableordisabledcommandextensions
usingthenewENABLEEXTENSIONSorDISABLEEXTENSIONSoptions,then
aftertheENDLOCAL,theenabled/disabledstateofcommandextensions
willberestoredtowhatitwaspriortothematchingSETLOCAL
commandexecution.

ERASE

TOP

Deletesoneormorefiles.
DEL[/P][/F][/S][/Q][/A[[:]attributes]]names
ERASE[/P][/F][/S][/Q][/A[[:]attributes]]names
namesSpecifiesalistofoneormorefilesordirectories.
[Link]
directoryisspecified,allfileswithinthedirectory
willbedeleted.
/PPromptsforconfirmationbeforedeletingeachfile.
/FForcedeletingofreadonlyfiles.
/SDeletespecifiedfilesfromallsubdirectories.
/QQuietmode,donotaskifoktodeleteonglobalwildcard
/ASelectsfilestodeletebasedonattributes
attributesRReadonlyfilesSSystemfiles
HHiddenfilesAFilesreadyforarchiving

[Link]

12/39

7/28/2015

DOSCommandIndex

INotcontentindexedFilesLReparsePoints
Prefixmeaningnot
IfCommandExtensionsareenabledDELandERASEchangeasfollows:
Thedisplaysemanticsofthe/Sswitcharereversedinthatitshows
youonlythefilesthataredeleted,nottheonesitcouldnotfind.

EXIT

TOP

[Link](commandinterpreter)orthecurrentbatch
script.
EXIT[/B][exitCode]
/Bspecifiestoexitthecurrentbatchscriptinsteadof
[Link],it
[Link]
[Link]/Bisspecified,sets
[Link],setstheprocess
exitcodewiththatnumber.

FC

TOP

Comparestwofilesorsetsoffilesanddisplaysthedifferencesbetween
them
FC[/A][/C][/L][/LBn][/N][/OFF[LINE]][/T][/U][/W][/nnnn]
[drive1:][path1]filename1[drive2:][path2]filename2
FC/B[drive1:][path1]filename1[drive2:][path2]filename2
/ADisplaysonlyfirstandlastlinesforeachsetofdifferences.
/BPerformsabinarycomparison.
/CDisregardsthecaseofletters.
/LComparesfilesasASCIItext.
/LBnSetsthemaximumconsecutivemismatchestothespecified
numberoflines.
/NDisplaysthelinenumbersonanASCIIcomparison.
/OFF[LINE]Donotskipfileswithofflineattributeset.
/TDoesnotexpandtabstospaces.
/UComparefilesasUNICODEtextfiles.
/WCompresseswhitespace(tabsandspaces)forcomparison.
/nnnnSpecifiesthenumberofconsecutivelinesthatmustmatch
afteramismatch.
[drive1:][path1]filename1
Specifiesthefirstfileorsetoffilestocompare.
[drive2:][path2]filename2
Specifiesthesecondfileorsetoffilestocompare.

FIND

TOP

Searchesforatextstringinafileorfiles.
FIND[/V][/C][/N][/I][/OFF[LINE]]"string"[[drive:][path]filename[...]]
/VDisplaysalllinesNOTcontainingthespecifiedstring.
/CDisplaysonlythecountoflinescontainingthestring.
/NDisplayslinenumberswiththedisplayedlines.
/IIgnoresthecaseofcharacterswhensearchingforthestring.
/OFF[LINE]Donotskipfileswithofflineattributeset.
"string"Specifiesthetextstringtofind.
[drive:][path]filename
Specifiesafileorfilestosearch.
Ifapathisnotspecified,FINDsearchesthetexttypedattheprompt
orpipedfromanothercommand.

FINDSTR

TOP

Searchesforstringsinfiles.
FINDSTR[/B][/E][/L][/R][/S][/I][/X][/V][/N][/M][/O][/P][/F:file]
[/C:string][/G:file][/D:dirlist][/A:colorattributes][/OFF[LINE]]
strings[[drive:][path]filename[...]]
/BMatchespatternifatthebeginningofaline.
/EMatchespatternifattheendofaline.
/LUsessearchstringsliterally.
/RUsessearchstringsasregularexpressions.
/SSearchesformatchingfilesinthecurrentdirectoryandall
subdirectories.
/ISpecifiesthatthesearchisnottobecasesensitive.

[Link]

13/39

7/28/2015

DOSCommandIndex

/XPrintslinesthatmatchexactly.
/VPrintsonlylinesthatdonotcontainamatch.
/NPrintsthelinenumberbeforeeachlinethatmatches.
/MPrintsonlythefilenameifafilecontainsamatch.
/OPrintscharacteroffsetbeforeeachmatchingline.
/PSkipfileswithnonprintablecharacters.
/OFF[LINE]Donotskipfileswithofflineattributeset.
/A:[Link]"color/?"
/F:fileReadsfilelistfromthespecifiedfile(/standsforconsole).
/C:stringUsesspecifiedstringasaliteralsearchstring.
/G:fileGetssearchstringsfromthespecifiedfile(/standsforconsole).
/D:dirSearchasemicolondelimitedlistofdirectories
stringsTexttobesearchedfor.
[drive:][path]filename
Specifiesafileorfilestosearch.
Usespacestoseparatemultiplesearchstringsunlesstheargumentisprefixed
with/[Link],'FINDSTR"hellothere"x.y'searchesfor"hello"or
"there"infilex.y.'FINDSTR/C:"hellothere"x.y'searchesfor
"hellothere"infilex.y.
Regularexpressionquickreference:
.Wildcard:anycharacter
*Repeat:zeroormoreoccurrencesofpreviouscharacterorclass
^Lineposition:beginningofline
$Lineposition:endofline
[class]Characterclass:anyonecharacterinset
[^class]Inverseclass:anyonecharacternotinset
[xy]Range:anycharacterswithinthespecifiedrange
\xEscape:literaluseofmetacharacterx
\<xyzWordposition:beginningofword
xyz\>Wordposition:endofword
ForfullinformationonFINDSTRregularexpressionsrefertotheonlineCommand
Reference.

FOR

TOP

Runsaspecifiedcommandforeachfileinasetoffiles.
FOR%variableIN(set)DOcommand[commandparameters]
%variableSpecifiesasingleletterreplaceableparameter.
(set)[Link].
commandSpecifiesthecommandtocarryoutforeachfile.
commandparameters
Specifiesparametersorswitchesforthespecifiedcommand.
TousetheFORcommandinabatchprogram,specify%%variableinstead
of%[Link],so%iisdifferent
from%I.
IfCommandExtensionsareenabled,thefollowingadditional
formsoftheFORcommandaresupported:
FOR/D%variableIN(set)DOcommand[commandparameters]
Ifsetcontainswildcards,thenspecifiestomatchagainstdirectory
namesinsteadoffilenames.
FOR/R[[drive:]path]%variableIN(set)DOcommand[commandparameters]
Walksthedirectorytreerootedat[drive:]path,executingtheFOR
[Link]
specificationisspecifiedafter/Rthenthecurrentdirectoryis
[Link](.)characterthenit
willjustenumeratethedirectorytree.
FOR/L%variableIN(start,step,end)DOcommand[commandparameters]
Thesetisasequenceofnumbersfromstarttoend,bystepamount.
So(1,1,5)wouldgeneratethesequence12345and(5,1,1)would
generatethesequence(54321)
FOR/F["options"]%variableIN(fileset)DOcommand[commandparameters]
FOR/F["options"]%variableIN("string")DOcommand[commandparameters]
FOR/F["options"]%variableIN('command')DOcommand[commandparameters]
or,ifusebackqoptionpresent:
FOR/F["options"]%variableIN(fileset)DOcommand[commandparameters]
FOR/F["options"]%variableIN('string')DOcommand[commandparameters]
FOR/F["options"]%variableIN(`command`)DOcommand[commandparameters]
[Link],read
andprocessedbeforegoingontothenextfileinfileset.
Processingconsistsofreadinginthefile,breakingitupinto
individuallinesoftextandthenparsingeachlineintozeroor
[Link]
variablevalue(s)settothefoundtokenstring(s).Bydefault,/F
passesthefirstblankseparatedtokenfromeachlineofeachfile.
[Link]
behaviorbyspecifyingtheoptional"options"[Link]
isaquotedstringwhichcontainsoneormorekeywordstospecify
[Link]:
eol=cspecifiesanendoflinecommentcharacter
(justone)

[Link]

14/39

7/28/2015

DOSCommandIndex

skip=nspecifiesthenumberoflinestoskipatthe
beginningofthefile.
delims=[Link]
defaultdelimitersetofspaceandtab.
tokens=x,y,mnspecifieswhichtokensfromeachlineareto
bepassedtotheforbodyforeachiteration.
Thiswillcauseadditionalvariablenamesto
[Link],
[Link]
thelastcharacterinthetokens=stringisan
asterisk,thenanadditionalvariableis
allocatedandreceivestheremainingtexton
thelineafterthelasttokenparsed.
usebackqspecifiesthatthenewsemanticsareinforce,
whereabackquotedstringisexecutedasa
commandandasinglequotedstringisa
literalstringcommandandallowstheuseof
doublequotestoquotefilenamesin
fileset.
Someexamplesmighthelp:
FOR/F"eol=;tokens=2,3*delims=,"%iin([Link])do@echo%i%j%k
[Link],ignoringlinesthatbeginwith
asemicolon,passingthe2ndand3rdtokenfromeachlinetothefor
body,withtokensdelimitedbycommasand/[Link]
bodystatementsreference%itogetthe2ndtoken,%jtogetthe
3rdtoken,and%[Link]
filenamesthatcontainspaces,youneedtoquotethefilenameswith
[Link],youalso
needtousetheusebackqoption,otherwisethedoublequoteswillbe
interpretedasdefiningaliteralstringtoparse.
%iisexplicitlydeclaredintheforstatementandthe%jand%k
areimplicitlydeclaredviathetokens=[Link]
to26tokensviathetokens=line,provideditdoesnotcausean
attempttodeclareavariablehigherthantheletter'z'or'Z'.
Remember,FORvariablesaresingleletter,casesensitive,global,
andyoucan'thavemorethan52totalactiveatanyonetime.
YoucanalsousetheFOR/Fparsinglogiconanimmediatestring,by
makingthefilesetbetweentheparenthesisaquotedstring,
[Link]
ofinputfromafileandparsed.
Finally,youcanusetheFOR/Fcommandtoparsetheoutputofa
[Link]
[Link]
line,[Link]
[Link]
example:
FOR/F"usebackqdelims=="%iIN(`set`)DO@echo%i
wouldenumeratetheenvironmentvariablenamesinthecurrent
environment.
Inaddition,substitutionofFORvariablereferenceshasbeenenhanced.
Youcannowusethefollowingoptionalsyntax:
%~Iexpands%Iremovinganysurroundingquotes(")
%~fIexpands%Itoafullyqualifiedpathname
%~dIexpands%Itoadriveletteronly
%~pIexpands%Itoapathonly
%~nIexpands%Itoafilenameonly
%~xIexpands%Itoafileextensiononly
%~sIexpandedpathcontainsshortnamesonly
%~aIexpands%Itofileattributesoffile
%~tIexpands%Itodate/timeoffile
%~zIexpands%Itosizeoffile
%~$PATH:IsearchesthedirectorieslistedinthePATH
environmentvariableandexpands%Itothe
fullyqualifiednameofthefirstonefound.
Iftheenvironmentvariablenameisnot
definedorthefileisnotfoundbythe
search,thenthismodifierexpandstothe
emptystring
Themodifierscanbecombinedtogetcompoundresults:
%~dpIexpands%Itoadriveletterandpathonly
%~nxIexpands%Itoafilenameandextensiononly
%~fsIexpands%Itoafullpathnamewithshortnamesonly
%~dp$PATH:IsearchesthedirectorieslistedinthePATH
environmentvariablefor%Iandexpandstothe
driveletterandpathofthefirstonefound.
%~ftzaIexpands%ItoaDIRlikeoutputline
Intheaboveexamples%IandPATHcanbereplacedbyothervalid
[Link]%~syntaxisterminatedbyavalidFORvariablename.
Pickinguppercasevariablenameslike%Imakesitmorereadableand
avoidsconfusionwiththemodifiers,whicharenotcasesensitive.

FORMAT

TOP

FormatsadiskforusewithWindows.

[Link]

15/39

7/28/2015

DOSCommandIndex

FORMATvolume[/FS:filesystem][/V:label][/Q][/A:size][/C][/X][/P:passes][/S:state]
FORMATvolume[/V:label][/Q][/F:size][/P:passes]
FORMATvolume[/V:label][/Q][/T:tracks/N:sectors][/P:passes]
FORMATvolume[/V:label][/Q][/P:passes]
FORMATvolume[/Q]
volumeSpecifiesthedriveletter(followedbyacolon),
mountpoint,orvolumename.
/FS:filesystemSpecifiesthetypeofthefilesystem(FAT,FAT32,exFAT,NTFS,
orUDF).
/V:labelSpecifiesthevolumelabel.
/[Link]/P.
/CNTFSonly:Filescreatedonthenewvolumewillbecompressed
bydefault.
/[Link]
handlestothevolumewouldnolongerbevalid.
/R:revisionUDFonly:ForcestheformattoaspecificUDFversion
(1.02,1.50,2.00,2.01,2.50).Thedefault
revisionis2.01.
/DUDF2.50only:Metadatawillbeduplicated.
/A:[Link]
arestronglyrecommendedforgeneraluse.
NTFSsupports512,1024,2048,4096,8192,16K,32K,64K.
FATsupports512,1024,2048,4096,8192,16K,32K,64K,
(128K,256Kforsectorsize>512bytes).
FAT32supports512,1024,2048,4096,8192,16K,32K,64K,
(128K,256Kforsectorsize>512bytes).
exFATsupports512,1024,2048,4096,8192,16K,32K,64K,
128K,256K,512K,1M,2M,4M,8M,16M,32M.
NotethattheFATandFAT32filessystemsimposethe
followingrestrictionsonthenumberofclustersonavolume:
FAT:Numberofclusters<=65526
FAT32:65526<Numberofclusters<4177918
Formatwillimmediatelystopprocessingifitdecidesthat
theaboverequirementscannotbemetusingthespecified
clustersize.
NTFScompressionisnotsupportedforallocationunitsizes
above4096.
/F:sizeSpecifiesthesizeofthefloppydisktoformat(1.44)
/T:tracksSpecifiesthenumberoftracksperdiskside.
/N:sectorsSpecifiesthenumberofsectorspertrack.
/P:[Link]
notvalidwith/Q
/S:stateWhere"state"iseither"enable"or"disable"
Shortnamesareenabledbydefault

FSUTIL

TOP

TheFSUTILutilityrequiresthatyouhaveadministrativeprivileges.

FTYPE

TOP

Displaysormodifiesfiletypesusedinfileextensionassociations
FTYPE[fileType[=[openCommandString]]]
fileTypeSpecifiesthefiletypetoexamineorchange
openCommandStringSpecifiestheopencommandtousewhenlaunchingfiles
ofthistype.
TypeFTYPEwithoutparameterstodisplaythecurrentfiletypesthat
[Link]
type,itdisplaysthecurrentopencommandstringforthatfiletype.
SpecifynothingfortheopencommandstringandtheFTYPEcommandwill
[Link]
commandstring%0or%1aresubstitutedwiththefilenamebeing
launchedthroughtheassocation.%*getsalltheparametersand%2
getsthe1stparameter,%3thesecond,etc.%~ngetsalltheremaining
parametersstartingwiththenthparameter,wherenmaybebetween2and9,
[Link]:
[Link]=PerlScript
FTYPEPerlScript=[Link]%1%*
wouldallowyoutoinvokeaPerlscriptasfollows:
script.pl123
Ifyouwanttoeliminatetheneedtotypetheextensions,thendothe
following:
setPATHEXT=.pl;%PATHEXT%
andthescriptcouldbeinvokedasfollows:
script123

[Link]

16/39

7/28/2015

DOSCommandIndex

GOTO

TOP

[Link].
GOTOlabel
labelSpecifiesatextstringusedinthebatchprogramasalabel.
Youtypealabelonalinebyitself,beginningwithacolon.
IfCommandExtensionsareenabledGOTOchangesasfollows:
GOTOcommandnowacceptsatargetlabelof:EOFwhichtransferscontrol
[Link]
[Link]/?fora
descriptionofextensionstotheCALLcommandthatmakethisfeature
useful.

GPRESULT

TOP

GPRESULT[/Ssystem[/Uusername[/P[password]]]][/SCOPEscope]
[/USERtargetusername][/R|/V|/Z]
Description:
ThiscommandlinetooldisplaystheResultantSetofPolicy(RSoP)
informationforatargetuserandcomputer.
ParameterList:
/SsystemSpecifiestheremotesystemtoconnectto.
/U[domain\]userSpecifiestheusercontextunderwhichthe
commandshouldexecute.
/P[password]Specifiesthepasswordforthegivenuser
[Link].
/SCOPEscopeSpecifieswhethertheuserorthe
computersettingsneedstobedisplayed.
Validvalues:"USER","COMPUTER".
/USER[domain\]userSpecifiestheusernameforwhichthe
RSOPdataistobedisplayed.
/RDisplaysRSoPsummarydata.
/VSpecifiesthatverboseinformationshould
[Link]
additionaldetailedsettingsthathave
beenappliedwithaprecedenceof1.
/ZSpecifiesthatthesuperverbose
[Link]
verboseinformationprovidesadditional
detailedsettingsthathavebeenapplied
[Link]
allowsyoutoseeifasettingwassetin
[Link]
onlinehelptopicformoreinformation.
/?Displaysthishelpmessage.
Examples:
GPRESULT/R
GPRESULT/USERtargetusername/V
GPRESULT/Ssystem/USERtargetusername/SCOPECOMPUTER/Z
GPRESULT/Ssystem/Uusername/Ppassword/SCOPEUSER/V

GRAFTABL

TOP

'GRAFTABL'isnotrecognizedasaninternalorexternalcommand,
operableprogramorbatchfile.

HELP

TOP

ICACLS

TOP

ProvideshelpinformationforWindowscommands.
HELP[command]
commanddisplayshelpinformationonthatcommand.

[Link]

17/39

7/28/2015

DOSCommandIndex

ICACLSname/saveaclfile[/T][/C][/L][/Q]
storestheDACLsforthefilesandfoldersthatmatchthename
intoaclfileforlaterusewith/[Link],
owner,orintegritylabelsarenotsaved.
ICACLSdirectory[/substituteSidOldSidNew[...]]/restoreaclfile
[/C][/L][/Q]
appliesthestoredDACLstofilesindirectory.
ICACLSname/setowneruser[/T][/C][/L][/Q]
[Link]
forceachangeofownership;[Link]
thatpurpose.
ICACLSname/findsidSid[/T][/C][/L][/Q]
findsallmatchingnamesthatcontainanACL
explicitlymentioningSid.
ICACLSname/verify[/T][/C][/L][/Q]
findsallfileswhoseACLisnotincanonicalformorwhose
lengthsareinconsistentwithACEcounts.
ICACLSname/reset[/T][/C][/L][/Q]
replacesACLswithdefaultinheritedACLsforallmatchingfiles.
ICACLSname[/grant[:r]Sid:perm[...]]
[/denySid:perm[...]]
[/remove[:g|:d]]Sid[...]][/T][/C][/L][/Q]
[/setintegritylevelLevel:policy[...]]
/grant[:r]Sid:[Link]:r,
thepermissionsreplaceanyprevioulygrantedexplicitpermissions.
Without:r,thepermissionsareaddedtoanypreviouslygranted
explicitpermissions.
/denySid:permexplicitlydeniesthespecifieduseraccessrights.
AnexplicitdenyACEisaddedforthestatedpermissionsand
thesamepermissionsinanyexplicitgrantareremoved.
/remove[:[g|d]][Link]
:g,[Link]
:d,itremovesalloccurrencesofdeniedrightstothatSid.
/setintegritylevel[(CI)(OI)]Levelexplicitlyaddsanintegrity
[Link]
of:
L[ow]
M[edium]
H[igh]
InheritanceoptionsfortheintegrityACEmayprecedethelevel
andareappliedonlytodirectories.
/inheritance:e|d|r
eenablesinheritance
ddisablesinheritanceandcopytheACEs
rremoveallinheritedACEs
Note:
[Link]
formisgiven,affixa*tothestartoftheSID.
/Tindicatesthatthisoperationisperformedonallmatching
files/directoriesbelowthedirectoriesspecifiedinthename.
/Cindicatesthatthisoperationwillcontinueonallfileerrors.
Errormessageswillstillbedisplayed.
/Lindicatesthatthisoperationisperformedonasymboliclink
itselfversusitstarget.
/Qindicatesthaticaclsshouldsupresssuccessmessages.
ICACLSpreservesthecanonicalorderingofACEentries:
Explicitdenials
Explicitgrants
Inheriteddenials
Inheritedgrants
permisapermissionmaskandcanbespecifiedinoneoftwoforms:
asequenceofsimplerights:
Nnoaccess
Ffullaccess
Mmodifyaccess
RXreadandexecuteaccess
Rreadonlyaccess
Wwriteonlyaccess
Ddeleteaccess
acommaseparatedlistinparenthesesofspecificrights:
DEdelete
RCreadcontrol
WDACwriteDAC
WOwriteowner
Ssynchronize
ASaccesssystemsecurity
MAmaximumallowed
GRgenericread
GWgenericwrite
GEgenericexecute
GAgenericall
RDreaddata/listdirectory
WDwritedata/addfile

[Link]

18/39

7/28/2015

DOSCommandIndex

ADappenddata/addsubdirectory
REAreadextendedattributes
WEAwriteextendedattributes
Xexecute/traverse
DCdeletechild
RAreadattributes
WAwriteattributes
inheritancerightsmayprecedeeitherformandareapplied
onlytodirectories:
(OI)objectinherit
(CI)containerinherit
(IO)inheritonly
(NP)don'tpropagateinherit
(I)permissioninheritedfromparentcontainer
Examples:
icaclsc:\windows\*/saveAclFile/T
WillsavetheACLsforallfilesunderc:\windows
anditssubdirectoriestoAclFile.
icaclsc:\windows\/restoreAclFile
WillrestoretheAclsforeveryfilewithin
AclFilethatexistsinc:\windowsanditssubdirectories.
icaclsfile/grantAdministrator:(D,WDAC)
WillgranttheuserAdministratorDeleteandWriteDAC
permissionstofile.
icaclsfile/grant*S110:(D,WDAC)
WillgranttheuserdefinedbysidS110Deleteand
WriteDACpermissionstofile.

IF

TOP

Performsconditionalprocessinginbatchprograms.
IF[NOT]ERRORLEVELnumbercommand
IF[NOT]string1==string2command
IF[NOT]EXISTfilenamecommand
NOTSpecifiesthatWindowsshouldcarryout
thecommandonlyiftheconditionisfalse.
ERRORLEVELnumberSpecifiesatrueconditionifthelastprogramrun
returnedanexitcodeequaltoorgreaterthanthenumber
specified.
string1==string2Specifiesatrueconditionifthespecifiedtextstrings
match.
EXISTfilenameSpecifiesatrueconditionifthespecifiedfilename
exists.
commandSpecifiesthecommandtocarryoutiftheconditionis
[Link]
willexecutethecommandaftertheELSEkeywordifthe
specifiedconditionisFALSE
[Link]
example:
IFEXISTfilename.(
delfilename.
)ELSE(
[Link].
)
ThefollowingwouldNOTworkbecausethedelcommandneedstobeterminated
byanewline:
[Link]
Norwouldthefollowingwork,sincetheELSEcommandmustbeonthesameline
astheendoftheIFcommand:
[Link].
[Link]
Thefollowingwouldworkifyouwantitallononeline:
IFEXISTfilename.(delfilename.)[Link]
IfCommandExtensionsareenabledIFchangesasfollows:
IF[/I]string1compareopstring2command
IFCMDEXTVERSIONnumbercommand
IFDEFINEDvariablecommand
wherecompareopmaybeoneof:
EQUequal
NEQnotequal
LSSlessthan
LEQlessthanorequal
GTRgreaterthan
GEQgreaterthanorequal

[Link]

19/39

7/28/2015

DOSCommandIndex

andthe/Iswitch,ifspecified,saystodocaseinsensitivestring
[Link]/Iswitchcanalsobeusedonthestring1==string2form
[Link],inthatifbothstring1and
string2arebothcomprisedofallnumericdigits,thenthestringsare
convertedtonumbersandanumericcomparisonisperformed.
TheCMDEXTVERSIONconditionalworksjustlikeERRORLEVEL,exceptitis
comparingagainstaninternalversionnumberassociatedwiththeCommand
[Link]
significantenhancementsareaddedtotheCommandExtensions.
CMDEXTVERSIONconditionalisnevertruewhenCommandExtensionsare
disabled.
TheDEFINEDconditionalworksjustlikeEXISTexceptittakesan
environmentvariablenameandreturnstrueiftheenvironmentvariable
isdefined.
%ERRORLEVEL%willexpandintoastringrepresentationof
thecurrentvalueofERRORLEVEL,providedthatthereisnotalready
anenvironmentvariablewiththenameERRORLEVEL,inwhichcaseyou
[Link],thefollowing
illustratesERRORLEVELuse:
gotoanswer%ERRORLEVEL%
:answer0
echoProgramhadreturncode0
:answer1
echoProgramhadreturncode1
Youcanalsousenumericalcomparisonsabove:
IF%ERRORLEVEL%LEQ1gotookay
%CMDCMDLINE%willexpandintotheoriginalcommandlinepassedto
[Link],providedthatthereisnot
alreadyanenvironmentvariablewiththenameCMDCMDLINE,inwhichcase
youwillgetitsvalueinstead.
%CMDEXTVERSION%willexpandintoastringrepresentationofthe
currentvalueofCMDEXTVERSION,providedthatthereisnotalready
anenvironmentvariablewiththenameCMDEXTVERSION,inwhichcaseyou
willgetitsvalueinstead.

LABEL

TOP

Creates,changes,ordeletesthevolumelabelofadisk.
LABEL[drive:][label]
LABEL[/MP][volume][label]
drive:Specifiesthedriveletterofadrive.
labelSpecifiesthelabelofthevolume.
/MPSpecifiesthatthevolumeshouldbetreatedasa
mountpointorvolumename.
volumeSpecifiesthedriveletter(followedbyacolon),
mountpoint,[Link],
the/MPflagisunnecessary.

MD

TOP

MKDIR

TOP

Createsadirectory.
MKDIR[drive:]path
MD[drive:]path
IfCommandExtensionsareenabledMKDIRchangesasfollows:
MKDIRcreatesanyintermediatedirectoriesinthepath,ifneeded.
Forexample,assume\adoesnotexistthen:
mkdir\a\b\c\d
isthesameas:
mkdir\a
chdir\a
mkdirb
chdirb
mkdirc
chdirc
mkdird
whichiswhatyouwouldhavetotypeifextensionsweredisabled.

Createsadirectory.
MKDIR[drive:]path

[Link]

20/39

7/28/2015

DOSCommandIndex

MD[drive:]path
IfCommandExtensionsareenabledMKDIRchangesasfollows:
MKDIRcreatesanyintermediatedirectoriesinthepath,ifneeded.
Forexample,assume\adoesnotexistthen:
mkdir\a\b\c\d
isthesameas:
mkdir\a
chdir\a
mkdirb
chdirb
mkdirc
chdirc
mkdird
whichiswhatyouwouldhavetotypeifextensionsweredisabled.

MKLINK

TOP

Createsasymboliclink.
MKLINK[[/D]|[/H]|[/J]]LinkTarget
/[Link]
symboliclink.
/HCreatesahardlinkinsteadofasymboliclink.
/JCreatesaDirectoryJunction.
Linkspecifiesthenewsymboliclinkname.
Targetspecifiesthepath(relativeorabsolute)thatthenewlink
refersto.

MODE

TOP

Configuressystemdevices.
Serialport:MODECOMm[:][BAUD=b][PARITY=p][DATA=d][STOP=s]
[to=on|off][xon=on|off][odsr=on|off]
[octs=on|off][dtr=on|off|hs]
[rts=on|off|hs|tg][idsr=on|off]
DeviceStatus:MODE[device][/STATUS]
Redirectprinting:MODELPTn[:]=COMm[:]
Selectcodepage:MODECON[:]CPSELECT=yyy
Codepagestatus:MODECON[:]CP[/STATUS]
Displaymode:MODECON[:][COLS=c][LINES=n]
Typematicrate:MODECON[:][RATE=rDELAY=d]

MORE

TOP

Displaysoutputonescreenatatime.
MORE[/E[/C][/P][/S][/Tn][+n]]<[drive:][path]filename
commandname|MORE[/E[/C][/P][/S][/Tn][+n]]
MORE/E[/C][/P][/S][/Tn][+n][files]
[drive:][path]filenameSpecifiesafiletodisplayone
screenatatime.
commandnameSpecifiesacommandwhoseoutput
willbedisplayed.
/EEnableextendedfeatures
/CClearscreenbeforedisplayingpage
/PExpandFormFeedcharacters
/SSqueezemultipleblanklinesintoasingleline
/TnExpandtabstonspaces(default8)
SwitchescanbepresentintheMOREenvironment
variable.
+nStartdisplayingthefirstfileatlinen
[Link]
areseparatedbyblanks.
Ifextendedfeaturesareenabled,thefollowingcommands
areacceptedattheMoreprompt:
PnDisplaynextnlines
SnSkipnextnlines

[Link]

21/39

7/28/2015

DOSCommandIndex

FDisplaynextfile
QQuit
=Showlinenumber
?Showhelpline
<space>Displaynextpage
<ret>Displaynextline

MOVE

TOP

Movesfilesandrenamesfilesanddirectories.
Tomoveoneormorefiles:
MOVE[/Y|/Y][drive:][path]filename1[,...]destination
Torenameadirectory:
MOVE[/Y|/Y][drive:][path]dirname1dirname2
[drive:][path]filename1Specifiesthelocationandnameofthefile
orfilesyouwanttomove.
[Link]
canconsistofadriveletterandcolon,a
directoryname,[Link]
onlyonefile,youcanalsoincludeafilenameif
youwanttorenamethefilewhenyoumoveit.
[drive:][path]dirname1Specifiesthedirectoryyouwanttorename.
dirname2Specifiesthenewnameofthedirectory.
/YSuppressespromptingtoconfirmyouwantto
overwriteanexistingdestinationfile.
/YCausespromptingtoconfirmyouwanttooverwrite
anexistingdestinationfile.
Theswitch/YmaybepresentintheCOPYCMDenvironmentvariable.
Thismaybeoverriddenwith/[Link]
topromptonoverwritesunlessMOVEcommandisbeingexecutedfrom
withinabatchscript.

OPENFILES

TOP

OPENFILES/parameter[arguments]
Description:
Enablesanadministratortolistordisconnectfilesandfolders
thathavebeenopenedonasystem.
ParameterList:
/DisconnectDisconnectsoneormoreopenfiles.
/QueryDisplaysfilesopenedlocallyorfromshared
folders.
/LocalEnables/Disablesthedisplayoflocalopenfiles.
/?Displaysthishelpmessage.
Examples:
OPENFILES/Disconnect/?
OPENFILES/Query/?
OPENFILES/Local/?

PATH

TOP

Displaysorsetsasearchpathforexecutablefiles.
PATH[[drive:]path[;...][;%PATH%]
PATH;
TypePATH;[Link]
onlyinthecurrentdirectory.
TypePATHwithoutparameterstodisplaythecurrentpath.
Including%PATH%inthenewpathsettingcausestheoldpathtobe
appendedtothenewsetting.

PAUSE

TOP

POPD

TOP

Suspendsprocessingofabatchprogramanddisplaysthemessage
Pressanykeytocontinue...

[Link]

22/39

7/28/2015

DOSCommandIndex

ChangestothedirectorystoredbythePUSHDcommand.
POPD
IfCommandExtensionsareenabledthePOPDcommandwilldelete
anytemporarydrivelettercreatedbyPUSHDwhenyouPOPDthat
driveoffthepusheddirectorystack.

PRINT

TOP

PROMPT

TOP

Printsatextfile.
PRINT[/D:device][[drive:][path]filename[...]]
/D:deviceSpecifiesaprintdevice.

[Link].
PROMPT[text]
textSpecifiesanewcommandprompt.
Promptcanbemadeupofnormalcharactersandthefollowingspecialcodes:
$A&(Ampersand)
$B|(pipe)
$C((Leftparenthesis)
$DCurrentdate
$EEscapecode(ASCIIcode27)
$F)(Rightparenthesis)
$G>(greaterthansign)
$HBackspace(erasespreviouscharacter)
$L<(lessthansign)
$NCurrentdrive
$PCurrentdriveandpath
$Q=(equalsign)
$S(space)
$TCurrenttime
$VWindowsversionnumber
$_Carriagereturnandlinefeed
$$$(dollarsign)
IfCommandExtensionsareenabledthePROMPTcommandsupports
thefollowingadditionalformattingcharacters:
$+zeroormoreplussign(+)charactersdependinguponthe
depthofthePUSHDdirectorystack,onecharacterforeach
levelpushed.
$MDisplaystheremotenameassociatedwiththecurrentdrive
letterortheemptystringifcurrentdriveisnotanetwork
drive.

PUSHD

TOP

StoresthecurrentdirectoryforusebythePOPDcommand,then
changestothespecifieddirectory.
PUSHD[path|..]
pathSpecifiesthedirectorytomakethecurrentdirectory.
IfCommandExtensionsareenabledthePUSHDcommandaccepts
networkpathsinadditiontothenormaldriveletterandpath.
Ifanetworkpathisspecified,PUSHDwillcreateatemporary
driveletterthatpointstothatspecifiednetworkresourceand
thenchangethecurrentdriveanddirectory,usingthenewly
[Link]
Z:ondown,usingthefirstunuseddriveletterfound.

RD

TOP

Removes(deletes)adirectory.
RMDIR[/S][/Q][drive:]path
RD[/S][/Q][drive:]path
/SRemovesalldirectoriesandfilesinthespecifieddirectory
[Link]
tree.

[Link]

23/39

7/28/2015

DOSCommandIndex

/QQuietmode,donotaskifoktoremoveadirectorytreewith/S

RECOVER

TOP

REM

TOP

REN

TOP

Recoversreadableinformationfromabadordefectivedisk.
RECOVER[drive:][path]filename
ConsulttheonlineCommandReferenceinWindowsHelp
beforeusingtheRECOVERcommand.

Recordscomments(remarks)[Link].
REM[comment]

Renamesafileorfiles.
RENAME[drive:][path]filename1filename2.
REN[drive:][path]filename1filename2.
Notethatyoucannotspecifyanewdriveorpathforyourdestinationfile.

RENAME

TOP

Renamesafileorfiles.
RENAME[drive:][path]filename1filename2.
REN[drive:][path]filename1filename2.
Notethatyoucannotspecifyanewdriveorpathforyourdestinationfile.

REPLACE

TOP

Replacesfiles.
REPLACE[drive1:][path1]filename[drive2:][path2][/A][/P][/R][/W]
REPLACE[drive1:][path1]filename[drive2:][path2][/P][/R][/S][/W][/U]
[drive1:][path1]filenameSpecifiesthesourcefileorfiles.
[drive2:][path2]Specifiesthedirectorywherefilesaretobe
replaced.
/[Link]
usewith/Sor/Uswitches.
/PPromptsforconfirmationbeforereplacingafileor
addingasourcefile.
/RReplacesreadonlyfilesaswellasunprotected
files.
/SReplacesfilesinallsubdirectoriesofthe
[Link]/A
switch.
/WWaitsforyoutoinsertadiskbeforebeginning.
/UReplaces(updates)onlyfilesthatareolderthan
[Link]/Aswitch.

RMDIR

TOP

Removes(deletes)adirectory.
RMDIR[/S][/Q][drive:]path
RD[/S][/Q][drive:]path
/SRemovesalldirectoriesandfilesinthespecifieddirectory
[Link]
tree.
/QQuietmode,donotaskifoktoremoveadirectorytreewith/S

ROBOCOPY
[Link]

TOP

24/39

7/28/2015

DOSCommandIndex

ROBOCOPY::RobustFileCopyforWindows

Started:ThuAug2908:32:442013
Usage::ROBOCOPYsourcedestination[file[file]...][options]
source::SourceDirectory(drive:\pathor\\server\share\path).
destination::DestinationDir(drive:\pathor\\server\share\path).
file::File(s)tocopy(names/wildcards:defaultis"*.*").
::
::Copyoptions:
::
/S::copySubdirectories,butnotemptyones.
/E::copysubdirectories,includingEmptyones.
/LEV:n::onlycopythetopnLEVelsofthesourcedirectorytree.
/Z::copyfilesinrestartablemode.
/B::copyfilesinBackupmode.
/ZB::userestartablemode;ifaccessdenieduseBackupmode.
/EFSRAW::copyallencryptedfilesinEFSRAWmode.
/COPY:copyflag[s]::whattoCOPYforfiles(defaultis/COPY:DAT).
(copyflags:D=Data,A=Attributes,T=Timestamps).
(S=Security=NTFSACLs,O=Ownerinfo,U=aUditinginfo).
/DCOPY:T::COPYDirectoryTimestamps.
/SEC::copyfileswithSECurity(equivalentto/COPY:DATS).
/COPYALL::COPYALLfileinfo(equivalentto/COPY:DATSOU).
/NOCOPY::COPYNOfileinfo(usefulwith/PURGE).
/SECFIX::FIXfileSECurityonallfiles,evenskippedfiles.
/TIMFIX::FIXfileTIMesonallfiles,evenskippedfiles.
/PURGE::deletedestfiles/dirsthatnolongerexistinsource.
/MIR::MIRroradirectorytree(equivalentto/Eplus/PURGE).
/MOV::MOVefiles(deletefromsourceaftercopying).
/MOVE::MOVEfilesANDdirs(deletefromsourceaftercopying).
/A+:[RASHCNET]::addthegivenAttributestocopiedfiles.
/A:[RASHCNET]::removethegivenAttributesfromcopiedfiles.
/CREATE::CREATEdirectorytreeandzerolengthfilesonly.
/FAT::createdestinationfilesusing8.3FATfilenamesonly.
/256::turnoffverylongpath(>256characters)support.
/MON:n::MONitorsource;runagainwhenmorethannchangesseen.
/MOT:m::MOnitorsource;runagaininmminutesTime,ifchanged.
/RH:hhmmhhmm::RunHourstimeswhennewcopiesmaybestarted.
/PF::checkrunhoursonaPerFile(notperpass)basis.
/IPG:n::InterPacketGap(ms),tofreebandwidthonslowlines.
/SL::copysymboliclinksversusthetarget.
/MT[:n]::Domultithreadedcopieswithnthreads(default8).
nmustbeatleast1andnotgreaterthan128.
Thisoptionisincompatiblewiththe/IPGand/EFSRAWoptions.
Redirectoutputusing/LOGoptionforbetterperformance.
::
::FileSelectionOptions:
::
/A::copyonlyfileswiththeArchiveattributeset.
/M::copyonlyfileswiththeArchiveattributeandresetit.
/IA:[RASHCNETO]::IncludeonlyfileswithanyofthegivenAttributesset.
/XA:[RASHCNETO]::eXcludefileswithanyofthegivenAttributesset.
/XFfile[file]...::eXcludeFilesmatchinggivennames/paths/wildcards.
/XDdirs[dirs]...::eXcludeDirectoriesmatchinggivennames/paths.
/XC::eXcludeChangedfiles.
/XN::eXcludeNewerfiles.
/XO::eXcludeOlderfiles.
/XX::eXcludeeXtrafilesanddirectories.
/XL::eXcludeLonelyfilesanddirectories.
/IS::IncludeSamefiles.
/IT::IncludeTweakedfiles.
/MAX:n::MAXimumfilesizeexcludefilesbiggerthannbytes.
/MIN:n::MINimumfilesizeexcludefilessmallerthannbytes.
/MAXAGE:n::MAXimumfileAGEexcludefilesolderthanndays/date.
/MINAGE:n::MINimumfileAGEexcludefilesnewerthanndays/date.
/MAXLAD:n::MAXimumLastAccessDateexcludefilesunusedsincen.
/MINLAD:n::MINimumLastAccessDateexcludefilesusedsincen.
(Ifn<1900thenn=ndays,elsen=YYYYMMDDdate).
/XJ::eXcludeJunctionpoints.(normallyincludedbydefault).
/FFT::assumeFATFileTimes(2secondgranularity).
/DST::compensateforonehourDSTtimedifferences.
/XJD::eXcludeJunctionpointsforDirectories.
/XJF::eXcludeJunctionpointsforFiles.

[Link]

25/39

7/28/2015

DOSCommandIndex

::
::RetryOptions:
::
/R:n::numberofRetriesonfailedcopies:default1million.
/W:n::Waittimebetweenretries:defaultis30seconds.
/REG::Save/R:nand/W:nintheRegistryasdefaultsettings.
/TBD::waitforsharenamesToBeDefined(retryerror67).
::
::LoggingOptions:
::
/L::Listonlydon'tcopy,timestampordeleteanyfiles.
/X::reportalleXtrafiles,notjustthoseselected.
/V::produceVerboseoutput,showingskippedfiles.
/TS::includesourcefileTimeStampsintheoutput.
/FP::includeFullPathnameoffilesintheoutput.
/BYTES::Printsizesasbytes.
/NS::NoSizedon'tlogfilesizes.
/NC::NoClassdon'tlogfileclasses.
/NFL::NoFileListdon'tlogfilenames.
/NDL::NoDirectoryListdon'tlogdirectorynames.
/NP::NoProgressdon'tdisplaypercentagecopied.
/ETA::showEstimatedTimeofArrivalofcopiedfiles.
/LOG:file::outputstatustoLOGfile(overwriteexistinglog).
/LOG+:file::outputstatustoLOGfile(appendtoexistinglog).
/UNILOG:file::outputstatustoLOGfileasUNICODE(overwriteexistinglog).
/UNILOG+:file::outputstatustoLOGfileasUNICODE(appendtoexistinglog).
/TEE::outputtoconsolewindow,aswellasthelogfile.
/NJH::NoJobHeader.
/NJS::NoJobSummary.
/UNICODE::outputstatusasUNICODE.
::
::JobOptions:
::
/JOB:jobname::takeparametersfromthenamedJOBfile.
/SAVE:jobname::SAVEparameterstothenamedjobfile
/QUIT::QUITafterprocessingcommandline(toviewparameters).
/NOSD::NOSourceDirectoryisspecified.
/NODD::NODestinationDirectoryisspecified.
/IF::IncludethefollowingFiles.

SET

TOP

Displays,sets,[Link].
SET[variable=[string]]
variableSpecifiestheenvironmentvariablename.
stringSpecifiesaseriesofcharacterstoassigntothevariable.
TypeSETwithoutparameterstodisplaythecurrentenvironmentvariables.
IfCommandExtensionsareenabledSETchangesasfollows:
SETcommandinvokedwithjustavariablename,noequalsignorvalue
willdisplaythevalueofallvariableswhoseprefixmatchesthename
[Link]:
SETP
woulddisplayallvariablesthatbeginwiththeletter'P'
SETcommandwillsettheERRORLEVELto1ifthevariablenameisnot
foundinthecurrentenvironment.
SETcommandwillnotallowanequalsigntobepartofthenameof
avariable.
TwonewswitcheshavebeenaddedtotheSETcommand:
SET/Aexpression
SET/Pvariable=[promptString]
The/Aswitchspecifiesthatthestringtotherightoftheequalsign
[Link]
isprettysimpleandsupportsthefollowingoperations,indecreasing
orderofprecedence:
()grouping
!~unaryoperators
*/%arithmeticoperators
+arithmeticoperators
<<>>logicalshift
&bitwiseand
^bitwiseexclusiveor
|bitwiseor
=*=/=%=+==assignment
&=^=|=<<=>>=

[Link]

26/39

7/28/2015

DOSCommandIndex

,expressionseparator
Ifyouuseanyofthelogicalormodulusoperators,youwillneedto
[Link]
expressionaretreatedasenvironmentvariablenameswhosevaluesare
[Link]
isspecifiedbutisnotdefinedinthecurrentenvironment,thenavalue
[Link]
variablevalueswithouthavingtotypeallthose%signstogettheir
[Link]/Aisexecutedfromthecommandlineoutsideofa
commandscript,[Link]
assignmentoperatorrequiresanenvironmentvariablenametotheleftof
[Link],unless
prefixedby0xforhexadecimalnumbers,and0foroctalnumbers.
[Link]
notationcanbeconfusing:08and09arenotvalidnumbersbecause8and
9arenotvalidoctaldigits.
The/Pswitchallowsyoutosetthevalueofavariabletoalineofinput
[Link]
[Link].
Environmentvariablesubstitutionhasbeenenhancedasfollows:
%PATH:str1=str2%
wouldexpandthePATHenvironmentvariable,substitutingeachoccurrence
of"str1"intheexpandedresultwith"str2"."str2"canbetheempty
stringtoeffectivelydeletealloccurrencesof"str1"fromtheexpanded
output."str1"canbeginwithanasterisk,inwhichcaseitwillmatch
everythingfromthebeginningoftheexpandedoutputtothefirst
occurrenceoftheremainingportionofstr1.
Mayalsospecifysubstringsforanexpansion.
%PATH:~10,5%
wouldexpandthePATHenvironmentvariable,andthenuseonlythe5
charactersthatbeginatthe11th(offset10)characteroftheexpanded
[Link],thenitdefaultstothe
[Link](offsetorlength)is
negative,thenthenumberusedisthelengthoftheenvironmentvariable
valueaddedtotheoffsetorlengthspecified.
%PATH:~10%
wouldextractthelast10charactersofthePATHvariable.
%PATH:~0,2%
wouldextractallbutthelast2charactersofthePATHvariable.
Finally,supportfordelayedenvironmentvariableexpansionhasbeen
[Link],butmaybe
enabled/disabledviathe/[Link]/?
Delayedenvironmentvariableexpansionisusefulforgettingaround
thelimitationsofthecurrentexpansionwhichhappenswhenaline
oftextisread,[Link]
demonstratestheproblemwithimmediatevariableexpansion:
setVAR=before
if"%VAR%"=="before"(
setVAR=after
if"%VAR%"=="after"@echoIfyouseethis,itworked
)
wouldneverdisplaythemessage,sincethe%VAR%inBOTHIFstatements
issubstitutedwhenthefirstIFstatementisread,sinceitlogically
includesthebodyoftheIF,[Link]
IFinsidethecompoundstatementisreallycomparing"before"with
"after"[Link],thefollowingexample
willnotworkasexpected:
setLIST=
for%iin(*)dosetLIST=%LIST%%i
echo%LIST%
inthatitwillNOTbuildupalistoffilesinthecurrentdirectory,
butinsteadwilljustsettheLISTvariabletothelastfilefound.
Again,thisisbecausethe%LIST%isexpandedjustoncewhenthe
FORstatementisread,andatthattimetheLISTvariableisempty.
SotheactualFORloopweareexecutingis:
for%iin(*)dosetLIST=%i
whichjustkeepssettingLISTtothelastfilefound.
Delayedenvironmentvariableexpansionallowsyoutouseadifferent
character(theexclamationmark)toexpandenvironmentvariablesat
[Link],theabove
examplescouldbewrittenasfollowstoworkasintended:
setVAR=before
if"%VAR%"=="before"(
setVAR=after
if"!VAR!"=="after"@echoIfyouseethis,itworked
)
setLIST=
for%iin(*)dosetLIST=!LIST!%i
echo%LIST%

[Link]

27/39

7/28/2015

DOSCommandIndex

IfCommandExtensionsareenabled,thenthereareseveraldynamic
environmentvariablesthatcanbeexpandedbutwhichdon'tshowupin
[Link]
computeddynamicallyeachtimethevalueofthevariableisexpanded.
Iftheuserexplicitlydefinesavariablewithoneofthesenames,then
thatdefinitionwilloverridethedynamiconedescribedbelow:
%CD%expandstothecurrentdirectorystring.
%DATE%expandstocurrentdateusingsameformatasDATEcommand.
%TIME%expandstocurrenttimeusingsameformatasTIMEcommand.
%RANDOM%expandstoarandomdecimalnumberbetween0and32767.
%ERRORLEVEL%expandstothecurrentERRORLEVELvalue
%CMDEXTVERSION%expandstothecurrentCommandProcessorExtensions
versionnumber.
%CMDCMDLINE%expandstotheoriginalcommandlinethatinvokedthe
CommandProcessor.
%HIGHESTNUMANODENUMBER%expandstothehighestNUMAnodenumber
onthismachine.

SETLOCAL

TOP

[Link]
changesmadeafterSETLOCALhasbeenissuedarelocaltothebatchfile.
[Link]
ofabatchscriptisreached,animpliedENDLOCALisexecutedforany
outstandingSETLOCALcommandsissuedbythatbatchscript.
SETLOCAL
IfCommandExtensionsareenabledSETLOCALchangesasfollows:
SETLOCALbatchcommandnowacceptsoptionalarguments:
ENABLEEXTENSIONS/DISABLEEXTENSIONS
[Link]
argumentstakesprecedenceovertheCMD/E:ONor/E:OFF
[Link]/?fordetails.
ENABLEDELAYEDEXPANSION/DISABLEDELAYEDEXPANSION
enableordisabledelayedenvironmentvariable
[Link]
/V:ONor/V:[Link]/?fordetails.
ThesemodificationslastuntilthematchingENDLOCALcommand,
regardlessoftheirsettingpriortotheSETLOCALcommand.
TheSETLOCALcommandwillsettheERRORLEVELvalueifgiven
[Link]
[Link]
todetermineiftheextensionsareavailable,usingthefollowing
technique:
VERIFYOTHER2>nul
SETLOCALENABLEEXTENSIONS
IFERRORLEVEL1echoUnabletoenableextensions
[Link],SETLOCALdoesNOT
[Link]
initializestheERRORLEVELvaluetoanonzerovalue.

SHIFT

TOP

Changesthepositionofreplaceableparametersinabatchfile.
SHIFT[/n]
IfCommandExtensionsareenabledtheSHIFTcommandsupports
the/nswitchwhichtellsthecommandtostartshiftingatthe
nthargument,[Link]:
SHIFT/2
wouldshift%3to%2,%4to%3,[Link]%0and%1unaffected.

SHUTDOWN

TOP

Usage:SHUTDOWN[/i|/l|/s|/r|/g|/a|/p|/h|/e][/f]
[/m\\computer][/txxx][/d[p|u:]xx:yy[/c"comment"]]
[Link]/?.
/?[Link].
/iDisplaythegraphicaluserinterface(GUI).
Thismustbethefirstoption.
/[Link]/mor/doptions.

[Link]

28/39

7/28/2015

DOSCommandIndex

/sShutdownthecomputer.
/rShutdownandrestartthecomputer.
/[Link]
rebooted,restartanyregisteredapplications.
/aAbortasystemshutdown.
Thiscanonlybeusedduringthetimeoutperiod.
/pTurnoffthelocalcomputerwithnotimeoutorwarning.
Canbeusedwith/dand/foptions.
/hHibernatethelocalcomputer.
Canbeusedwiththe/foption.
/eDocumentthereasonforanunexpectedshutdownofacomputer.
/m\\computerSpecifythetargetcomputer.
/txxxSetthetimeoutperiodbeforeshutdowntoxxxseconds.
Thevalidrangeis0315360000(10years),withadefaultof30.
Ifthetimeoutperiodisgreaterthan0,the/fparameteris
implied.
/c"comment"Commentonthereasonfortherestartorshutdown.
Maximumof512charactersallowed.
/fForcerunningapplicationstoclosewithoutforewarningusers.
The/fparameterisimpliedwhenavaluegreaterthan0is
specifiedforthe/tparameter.
/d[p|u:]xx:yyProvidethereasonfortherestartorshutdown.
pindicatesthattherestartorshutdownisplanned.
uindicatesthatthereasonisuserdefined.
Ifneitherpnoruisspecifiedtherestartorshutdownis
unplanned.
xxisthemajorreasonnumber(positiveintegerlessthan256).
yyistheminorreasonnumber(positiveintegerlessthan65536).
Reasonsonthiscomputer:
(E=ExpectedU=UnexpectedP=planned,C=customerdefined)
Type
Major Minor Title
U
E
EP
U
E
EP
E
EP
E
EP
P
E
EP
P

P
E
EP
EP
E
E
U
U
E
EP
E
U
U
P

0
0
0
0
1
1
1
1
2
2
2
2
2
2
2
2
2
2
4
4
4
4
4
5
5
5
5
5
6
6
7

0
0
0
5
1
1
2
2
2
2
3
4
4
16
17
17
18
18
1
1
2
5
6
15
19
19
19
20
11
12
0

Other(Unplanned)
Other(Unplanned)
Other(Planned)
OtherFailure:SystemUnresponsive
Hardware:Maintenance(Unplanned)
Hardware:Maintenance(Planned)
Hardware:Installation(Unplanned)
Hardware:Installation(Planned)
OperatingSystem:Recovery(Planned)
OperatingSystem:Recovery(Planned)
OperatingSystem:Upgrade(Planned)
OperatingSystem:Reconfiguration(Unplanned)
OperatingSystem:Reconfiguration(Planned)
OperatingSystem:Servicepack(Planned)
OperatingSystem:Hotfix(Unplanned)
OperatingSystem:Hotfix(Planned)
OperatingSystem:Securityfix(Unplanned)
OperatingSystem:Securityfix(Planned)
Application:Maintenance(Unplanned)
Application:Maintenance(Planned)
Application:Installation(Planned)
Application:Unresponsive
Application:Unstable
SystemFailure:Stoperror
Securityissue
Securityissue
Securityissue
Lossofnetworkconnectivity(Unplanned)
PowerFailure:CordUnplugged
PowerFailure:Environment
LegacyAPIshutdown

SORT

TOP

SORT[/R][/+n][/Mkilobytes][/Llocale][/RECrecordbytes]
[[drive1:][path1]filename1][/T[drive2:][path2]]
[/O[drive3:][path3]filename3]
/+nSpecifiesthecharacternumber,n,to
begineachcomparison./+3indicatesthat
eachcomparisonshouldbeginatthe3rd
[Link]
thanncharacterscollatebeforeotherlines.
Bydefaultcomparisonsstartatthefirst
characterineachline.
/L[OCALE]localeOverridesthesystemdefaultlocalewith
[Link]""C""localeyields
thefastestcollatingsequenceandis
[Link]
isalwayscaseinsensitive.
/M[EMORY]kilobytesSpecifiesamountofmainmemorytousefor

[Link]

29/39

7/28/2015

DOSCommandIndex

thesort,[Link]
alwaysconstrainedtobeaminimumof160
[Link]
theexactamountwillbeusedforthesort,
regardlessofhowmuchmainmemoryis
available.

Thebestperformanceisusuallyachievedby
[Link]
sortwillbedonewithonepass(notemporary
file)ifitfitsinthedefaultmaximum
memorysize,otherwisethesortwillbedone
intwopasses(withthepartiallysorteddata
beingstoredinatemporaryfile)suchthat
theamountsofmemoryusedforboththesort
[Link]
maximummemorysizeis90%ofavailablemain
memoryifboththeinputandoutputare
files,and45%ofmainmemoryotherwise.
/REC[ORD_MAXIMUM]charactersSpecifiesthemaximumnumberofcharacters
inarecord(default4096,maximum65535).
/R[EVERSE]Reversesthesortorder;thatis,
sortsZtoA,then9to0.
[drive1:][path1][Link]
specified,thestandardinputissorted.
Specifyingtheinputfileisfasterthan
redirectingthesamefileasstandardinput.
/T[EMPORARY]
[drive2:][path2]Specifiesthepathofthedirectorytohold
thesort'sworkingstorage,incasethedata
[Link]
tousethesystemtemporarydirectory.
/O[UTPUT]
[drive3:][path3]filename3Specifiesthefilewherethesortedinputis
[Link],thedatais
[Link]
theoutputfileisfasterthanredirecting
standardoutputtothesamefile.

START

TOP

Startsaseparatewindowtorunaspecifiedprogramorcommand.
START["title"][/Dpath][/I][/MIN][/MAX][/SEPARATE|/SHARED]
[/LOW|/NORMAL|/HIGH|/REALTIME|/ABOVENORMAL|/BELOWNORMAL]
[/NODE<NUMAnode>][/AFFINITY<hexaffinitymask>][/WAIT][/B]
[command/program][parameters]
"title"Titletodisplayinwindowtitlebar.
pathStartingdirectory.
[Link]
applicationhas^[Link]
enables^Cprocessing,^Breakistheonlywaytointerrupt
theapplication.
IThenewenvironmentwillbetheoriginalenvironmentpassed
[Link].
MINStartwindowminimized.
MAXStartwindowmaximized.

[Link]

30/39

7/28/2015

DOSCommandIndex

SEPARATEStart16bitWindowsprograminseparatememoryspace.
SHAREDStart16bitWindowsprograminsharedmemoryspace.
LOWStartapplicationintheIDLEpriorityclass.
NORMALStartapplicationintheNORMALpriorityclass.
HIGHStartapplicationintheHIGHpriorityclass.
REALTIMEStartapplicationintheREALTIMEpriorityclass.
ABOVENORMALStartapplicationintheABOVENORMALpriorityclass.
BELOWNORMALStartapplicationintheBELOWNORMALpriorityclass.
NODESpecifiesthepreferredNonUniformMemoryArchitecture(NUMA)
nodeasadecimalinteger.
AFFINITYSpecifiestheprocessoraffinitymaskasahexadecimalnumber.
Theprocessisrestrictedtorunningontheseprocessors.
Theaffinitymaskisinterpreteddifferentlywhen/AFFINITYand
/[Link]
node'sprocessormaskisrightshiftedtobeginatbitzero.
Theprocessisrestrictedtorunningonthoseprocessorsin
commonbetweenthespecifiedaffinitymaskandtheNUMAnode.
Ifnoprocessorsareincommon,theprocessisrestrictedto
runningonthespecifiedNUMAnode.
WAITStartapplicationandwaitforittoterminate.
command/program
Ifitisaninternalcmdcommandorabatchfilethen
thecommandprocessorisrunwiththe/[Link].
Thismeansthatthewindowwillremainafterthecommand
hasbeenrun.
Ifitisnotaninternalcmdcommandorbatchfilethen
itisaprogramandwillrunaseitherawindowedapplication
oraconsoleapplication.
parametersThesearetheparameterspassedtothecommand/program.
NOTE:TheSEPARATEandSHAREDoptionsarenotsupportedon64bitplatforms.
Specifying/NODEallowsprocessestobecreatedinawaythatleveragesmemory
[Link],twoprocessesthatcommunicatewith
eachotherheavilythroughsharedmemorycanbecreatedtosharethesame
[Link]
memoryfromthesameNUMAnodewhenpossible,andtheyarefreetorunon
processorsoutsidethespecifiednode.
start/[Link]
start/[Link]
Thesetwoprocessescanbefurtherconstrainedtorunonspecificprocessors
[Link],application1runsonthe
lowordertwoprocessorsofthenode,whileapplication2runsonthenexttwo
[Link]
[Link]
nodenumberforthatcomputerwithouthavingtochangetheaffinitymask.
start/NODE1/[Link]
start/NODE1/[Link]
IfCommandExtensionsareenabled,externalcommandinvocation
throughthecommandlineortheSTARTcommandchangesasfollows:
nonexecutablefilesmaybeinvokedthroughtheirfileassociationjust
bytypingthenameofthefileasacommand.([Link]
[Link]).
SeetheASSOCandFTYPEcommandsforhowtocreatethese
associationsfromwithinacommandscript.
Whenexecutinganapplicationthatisa32bitGUIapplication,[Link]
doesnotwaitfortheapplicationtoterminatebeforereturningto
[Link]
withinacommandscript.
Whenexecutingacommandlinewhosefirsttokenisthestring"CMD"
withoutanextensionorpathqualifier,then"CMD"isreplacedwith
[Link]
fromthecurrentdirectory.
WhenexecutingacommandlinewhosefirsttokendoesNOTcontainan
extension,[Link]
environmentvariabletodeterminewhichextensionstolookfor
[Link]
is:
.COM;.EXE;.BAT;.CMD
NoticethesyntaxisthesameasthePATHvariable,with
semicolonsseparatingthedifferentelements.
Whensearchingforanexecutable,ifthereisnomatchonanyextension,
[Link],the
[Link]
commandline,itistheequivalenttodoingaCD/Dtothatpath.

SUBST

TOP

Associatesapathwithadriveletter.
SUBST[drive1:[drive2:]path]
SUBSTdrive1:/D
drive1:Specifiesavirtualdrivetowhichyouwanttoassignapath.

[Link]

31/39

7/28/2015

DOSCommandIndex

[drive2:]pathSpecifiesaphysicaldriveandpathyouwanttoassignto
avirtualdrive.
/DDeletesasubstituted(virtual)drive.
TypeSUBSTwithnoparameterstodisplayalistofcurrentvirtualdrives.

SYSTEMINFO

TOP

SYSTEMINFO[/Ssystem[/Uusername[/P[password]]]][/FOformat][/NH]
Description:
Thistooldisplaysoperatingsystemconfigurationinformationfor
alocalorremotemachine,includingservicepacklevels.
ParameterList:
/SsystemSpecifiestheremotesystemtoconnectto.
/U[domain\]userSpecifiestheusercontextunderwhich
thecommandshouldexecute.
/P[password]Specifiesthepasswordforthegiven
[Link].
/FOformatSpecifiestheformatinwhichtheoutput
istobedisplayed.
Validvalues:"TABLE","LIST","CSV".
/NHSpecifiesthatthe"ColumnHeader"should
notbedisplayedintheoutput.
Validonlyfor"TABLE"and"CSV"formats.
/?Displaysthishelpmessage.
Examples:
SYSTEMINFO
SYSTEMINFO/?
SYSTEMINFO/Ssystem
SYSTEMINFO/Ssystem/Uuser
SYSTEMINFO/Ssystem/Udomain\user/Ppassword/FOTABLE
SYSTEMINFO/Ssystem/FOLIST
SYSTEMINFO/Ssystem/FOCSV/NH

TASKLIST

TOP

TASKLIST[/Ssystem[/Uusername[/P[password]]]]
[/M[module]|/SVC|/V][/FIfilter][/FOformat][/NH]
Description:
Thistooldisplaysalistofcurrentlyrunningprocesseson
eitheralocalorremotemachine.
ParameterList:
/SsystemSpecifiestheremotesystemtoconnectto.
/U[domain\]userSpecifiestheusercontextunderwhich
thecommandshouldexecute.
/P[password]Specifiesthepasswordforthegiven
[Link].
/M[module]Listsalltaskscurrentlyusingthegiven
exe/[Link]
specifiedallloadedmodulesaredisplayed.
/SVCDisplaysserviceshostedineachprocess.
/VDisplaysverbosetaskinformation.
/FIfilterDisplaysasetoftasksthatmatcha
givencriteriaspecifiedbythefilter.
/FOformatSpecifiestheoutputformat.
Validvalues:"TABLE","LIST","CSV".
/NHSpecifiesthatthe"ColumnHeader"should
notbedisplayedintheoutput.
Validonlyfor"TABLE"and"CSV"formats.
/?Displaysthishelpmessage.
Filters:
FilterNameValidOperatorsValidValue(s)

STATUSeq,neRUNNING|
NOTRESPONDING|UNKNOWN
IMAGENAMEeq,neImagename
PIDeq,ne,gt,lt,ge,lePIDvalue
SESSIONeq,ne,gt,lt,ge,leSessionnumber
SESSIONNAMEeq,neSessionname
CPUTIMEeq,ne,gt,lt,ge,leCPUtimeintheformat
ofhh:mm:ss.
hhhours,

[Link]

32/39

7/28/2015

DOSCommandIndex

mmminutes,ssseconds
MEMUSAGEeq,ne,gt,lt,ge,leMemoryusageinKB
USERNAMEeq,neUsernamein[domain\]user
format
SERVICESeq,neServicename
WINDOWTITLEeq,neWindowtitle
MODULESeq,neDLLname
NOTE:"WINDOWTITLE"and"STATUS"filtersarenotsupportedwhenquerying
aremotemachine.
Examples:
TASKLIST
TASKLIST/M
TASKLIST/V/FOCSV
TASKLIST/SVC/FOLIST
TASKLIST/Mwbem*
TASKLIST/Ssystem/FOLIST
TASKLIST/Ssystem/Udomain\username/FOCSV/NH
TASKLIST/Ssystem/Uusername/Ppassword/FOTABLE/NH
TASKLIST/FI"USERNAMEneNTAUTHORITY\SYSTEM"/FI"STATUSeqrunning"

TASKKILL

TOP

TASKKILL[/Ssystem[/Uusername[/P[password]]]]
{[/FIfilter][/PIDprocessid|/IMimagename]}[/T][/F]
Description:
Thistoolisusedtoterminatetasksbyprocessid(PID)orimagename.
ParameterList:
/SsystemSpecifiestheremotesystemtoconnectto.
/U[domain\]userSpecifiestheusercontextunderwhichthe
commandshouldexecute.
/P[password]Specifiesthepasswordforthegivenuser
[Link].
/FIfilterAppliesafiltertoselectasetoftasks.
Allows"*"[Link]*
/PIDprocessidSpecifiesthePIDoftheprocesstobeterminated.
UseTaskListtogetthePID.
/IMimagenameSpecifiestheimagenameoftheprocess
[Link]'*'canbeused
tospecifyalltasksorimagenames.
/TTerminatesthespecifiedprocessandany
childprocesseswhichwerestartedbyit.
/FSpecifiestoforcefullyterminatetheprocess(es).
/?Displaysthishelpmessage.
Filters:
FilterNameValidOperatorsValidValue(s)

STATUSeq,neRUNNING|
NOTRESPONDING|UNKNOWN
IMAGENAMEeq,neImagename
PIDeq,ne,gt,lt,ge,lePIDvalue
SESSIONeq,ne,gt,lt,ge,leSessionnumber.
CPUTIMEeq,ne,gt,lt,ge,leCPUtimeintheformat
ofhh:mm:ss.
hhhours,
mmminutes,ssseconds
MEMUSAGEeq,ne,gt,lt,ge,leMemoryusageinKB
USERNAMEeq,neUsernamein[domain\]user
format
MODULESeq,neDLLname
SERVICESeq,neServicename
WINDOWTITLEeq,neWindowtitle
NOTE

1)Wildcard'*'for/IMswitchisacceptedonlywhenafilterisapplied.
2)Terminationofremoteprocesseswillalwaysbedoneforcefully(/F).
3)"WINDOWTITLE"and"STATUS"filtersarenotconsideredwhenaremote
machineisspecified.
Examples:
TASKKILL/[Link]
TASKKILL/PID1230/PID1241/PID1253/T
TASKKILL/F/[Link]/T
TASKKILL/F/FI"PIDge1000"/FI"WINDOWTITLEneuntitle*"
TASKKILL/F/FI"USERNAMEeqNTAUTHORITY\SYSTEM"/[Link]
TASKKILL/Ssystem/Udomain\username/FI"USERNAMEneNT*"/IM*
TASKKILL/Ssystem/Uusername/Ppassword/FI"IMAGENAMEeqnote*"

TIME
[Link]

TOP

33/39

7/28/2015

DOSCommandIndex

Displaysorsetsthesystemtime.
TIME[/T|time]
TypeTIMEwithnoparameterstodisplaythecurrenttimesettingandaprompt
[Link].
IfCommandExtensionsareenabledtheTIMEcommandsupports
the/Tswitchwhichtellsthecommandtojustoutputthe
currenttime,withoutpromptingforanewtime.

TITLE

TOP

TREE

TOP

TYPE

TOP

VER

TOP

VERIFY

TOP

Setsthewindowtitleforthecommandpromptwindow.
TITLE[string]
stringSpecifiesthetitleforthecommandpromptwindow.

Graphicallydisplaysthefolderstructureofadriveorpath.
TREE[drive:][path][/F][/A]
/FDisplaythenamesofthefilesineachfolder.
/AUseASCIIinsteadofextendedcharacters.

Displaysthecontentsofatextfileorfiles.
TYPE[drive:][path]filename

DisplaystheWindowsversion.
VER

[Link]
disk.
VERIFY[ON|OFF]
TypeVERIFYwithoutaparametertodisplaythecurrentVERIFYsetting.

VOL

TOP

XCOPY

TOP

Displaysthediskvolumelabelandserialnumber,iftheyexist.
VOL[drive:]

Copiesfilesanddirectorytrees.
XCOPYsource[destination][/A|/M][/D[:date]][/P][/S[/E]][/V][/W]
[/C][/I][/Q][/F][/L][/G][/H][/R][/T][/U]
[/K][/N][/O][/X][/Y][/Y][/Z][/B]
[/EXCLUDE:file1[+file2][+file3]...]
sourceSpecifiesthefile(s)tocopy.
destinationSpecifiesthelocationand/ornameofnewfiles.
/ACopiesonlyfileswiththearchiveattributeset,
doesn'tchangetheattribute.
/MCopiesonlyfileswiththearchiveattributeset,
turnsoffthearchiveattribute.
/D:mdyCopiesfileschangedonorafterthespecifieddate.

[Link]

34/39

7/28/2015

DOSCommandIndex

Ifnodateisgiven,copiesonlythosefileswhose
sourcetimeisnewerthanthedestinationtime.
/EXCLUDE:file1[+file2][+file3]...
[Link]
[Link]
stringsmatchanypartoftheabsolutepathofthefiletobe
copied,[Link]
example,specifyingastringlike\obj\[Link]
allfilesunderneaththedirectoryobjorallfileswiththe
.objextensionrespectively.
/PPromptsyoubeforecreatingeachdestinationfile.
/SCopiesdirectoriesandsubdirectoriesexceptemptyones.
/ECopiesdirectoriesandsubdirectories,includingemptyones.
Sameas/S/[Link]/T.
/VVerifiesthesizeofeachnewfile.
/WPromptsyoutopressakeybeforecopying.
/CContinuescopyingeveniferrorsoccur.
/IIfdestinationdoesnotexistandcopyingmorethanonefile,
assumesthatdestinationmustbeadirectory.
/QDoesnotdisplayfilenameswhilecopying.
/FDisplaysfullsourceanddestinationfilenameswhilecopying.
/LDisplaysfilesthatwouldbecopied.
/GAllowsthecopyingofencryptedfilestodestinationthatdoes
notsupportencryption.
/HCopieshiddenandsystemfilesalso.
/ROverwritesreadonlyfiles.
/TCreatesdirectorystructure,[Link]
includeemptydirectoriesorsubdirectories./T/Eincludes
emptydirectoriesandsubdirectories.
/UCopiesonlyfilesthatalreadyexistindestination.
/[Link].
/NCopiesusingthegeneratedshortnames.
/OCopiesfileownershipandACLinformation.
/XCopiesfileauditsettings(implies/O).
/YSuppressespromptingtoconfirmyouwanttooverwritean
existingdestinationfile.
/YCausespromptingtoconfirmyouwanttooverwritean
existingdestinationfile.
/ZCopiesnetworkedfilesinrestartablemode.
/BCopiestheSymbolicLinkitselfversusthetargetofthelink.
/JCopiesusingunbufferedI/[Link].
Theswitch/YmaybepresetintheCOPYCMDenvironmentvariable.
Thismaybeoverriddenwith/Yonthecommandline.

WMIC

TOP

[globalswitches]<command>

Thefollowingglobalswitchesareavailable:
/NAMESPACEPathforthenamespacethealiasoperateagainst.
/ROLEPathfortherolecontainingthealiasdefinitions.
/NODEServersthealiaswilloperateagainst.
/IMPLEVELClientimpersonationlevel.
/AUTHLEVELClientauthenticationlevel.
/LOCALELanguageidtheclientshoulduse.
/PRIVILEGESEnableordisableallprivileges.
/TRACEOutputsdebugginginformationtostderr.
/RECORDLogsallinputcommandsandoutput.
/INTERACTIVESetsorresetstheinteractivemode.
/FAILFASTSetsorresetstheFailFastmode.
/USERUsertobeusedduringthesession.
/PASSWORDPasswordtobeusedforsessionlogin.
/OUTPUTSpecifiesthemodeforoutputredirection.
/APPENDSpecifiesthemodeforoutputredirection.
/AGGREGATESetsorresetsaggregatemode.
/AUTHORITYSpecifiesthe<authoritytype>fortheconnection.
/?[:<BRIEF|FULL>]Usageinformation.

Formoreinformationonaspecificglobalswitch,type:switchname/?

[Link]

35/39

7/28/2015

DOSCommandIndex

Thefollowingalias/esareavailableinthecurrentrole:
ALIASAccesstothealiasesavailableonthelocalsystem
BASEBOARDBaseboard(alsoknownasamotherboardorsystemboard)management.
BIOSBasicinput/outputservices(BIOS)management.
BOOTCONFIGBootconfigurationmanagement.
CDROMCDROMmanagement.
COMPUTERSYSTEMComputersystemmanagement.
CPUCPUmanagement.
CSPRODUCTComputersystemproductinformationfromSMBIOS.
DATAFILEDataFileManagement.
DCOMAPPDCOMApplicationmanagement.
DESKTOPUser'sDesktopmanagement.
DESKTOPMONITORDesktopMonitormanagement.
DEVICEMEMORYADDRESSDevicememoryaddressesmanagement.
DISKDRIVEPhysicaldiskdrivemanagement.
DISKQUOTADiskspaceusageforNTFSvolumes.
DMACHANNELDirectmemoryaccess(DMA)channelmanagement.
ENVIRONMENTSystemenvironmentsettingsmanagement.
FSDIRFilesystemdirectoryentrymanagement.
GROUPGroupaccountmanagement.
IDECONTROLLERIDEControllermanagement.
IRQInterruptrequestline(IRQ)management.
JOBProvidesaccesstothejobsscheduledusingthescheduleservice.
LOADORDERManagementofsystemservicesthatdefineexecutiondependencies.
LOGICALDISKLocalstoragedevicemanagement.
LOGONLOGONSessions.
MEMCACHECachememorymanagement.
MEMORYCHIPMemorychipinformation.
MEMPHYSICALComputersystem'sphysicalmemorymanagement.
NETCLIENTNetworkClientmanagement.
NETLOGINNetworklogininformation(ofaparticularuser)management.
NETPROTOCOLProtocols(andtheirnetworkcharacteristics)management.
NETUSEActivenetworkconnectionmanagement.
NICNetworkInterfaceController(NIC)management.
NICCONFIGNetworkadaptermanagement.
NTDOMAINNTDomainmanagement.
NTEVENTEntriesintheNTEventLog.
NTEVENTLOGNTeventlogfilemanagement.
ONBOARDDEVICEManagementofcommonadapterdevicesbuiltintothemotherboard(systemboard).
OSInstalledOperatingSystem/smanagement.
PAGEFILEVirtualmemoryfileswappingmanagement.
PAGEFILESETPagefilesettingsmanagement.
PARTITIONManagementofpartitionedareasofaphysicaldisk.
PORTI/Oportmanagement.
PORTCONNECTORPhysicalconnectionportsmanagement.
PRINTERPrinterdevicemanagement.
PRINTERCONFIGPrinterdeviceconfigurationmanagement.
PRINTJOBPrintjobmanagement.
PROCESSProcessmanagement.
PRODUCTInstallationpackagetaskmanagement.
QFEQuickFixEngineering.

[Link]

36/39

7/28/2015

DOSCommandIndex

QUOTASETTINGSettinginformationfordiskquotasonavolume.
RDACCOUNTRemoteDesktopconnectionpermissionmanagement.
RDNICRemoteDesktopconnectionmanagementonaspecificnetworkadapter.
RDPERMISSIONSPermissionstoaspecificRemoteDesktopconnection.
RDTOGGLETurningRemoteDesktoplisteneronoroffremotely.
RECOVEROSInformationthatwillbegatheredfrommemorywhentheoperatingsystemfails.
REGISTRYComputersystemregistrymanagement.
SCSICONTROLLERSCSIControllermanagement.
SERVERServerinformationmanagement.
SERVICEServiceapplicationmanagement.
SHADOWCOPYShadowcopymanagement.
SHADOWSTORAGEShadowcopystorageareamanagement.
SHARESharedresourcemanagement.
SOFTWAREELEMENTManagementoftheelementsofasoftwareproductinstalledonasystem.
SOFTWAREFEATUREManagementofsoftwareproductsubsetsofSoftwareElement.
SOUNDDEVSoundDevicemanagement.
STARTUPManagementofcommandsthatrunautomaticallywhenuserslogontothecomputersystem.
SYSACCOUNTSystemaccountmanagement.
SYSDRIVERManagementofthesystemdriverforabaseservice.
SYSTEMENCLOSUREPhysicalsystemenclosuremanagement.
SYSTEMSLOTManagementofphysicalconnectionpointsincludingports,slotsandperipherals,andproprietaryconnectionspoints.
TAPEDRIVETapedrivemanagement.
TEMPERATUREDatamanagementofatemperaturesensor(electronicthermometer).
TIMEZONETimezonedatamanagement.
UPSUninterruptiblepowersupply(UPS)management.
USERACCOUNTUseraccountmanagement.
VOLTAGEVoltagesensor(electronicvoltmeter)datamanagement.
VOLUMELocalstoragevolumemanagement.
VOLUMEQUOTASETTINGAssociatesthediskquotasettingwithaspecificdiskvolume.
VOLUMEUSERQUOTAPeruserstoragevolumequotamanagement.
WMISETWMIserviceoperationalparametersmanagement.

Formoreinformationonaspecificalias,type:alias/?

CLASSEscapestofullWMIschema.
PATHEscapestofullWMIobjectpaths.
CONTEXTDisplaysthestateofalltheglobalswitches.
QUIT/EXITExitstheprogram.

FormoreinformationonCLASS/PATH/CONTEXT,type:(CLASS|PATH|CONTEXT)/?

DOSBatchScriptSourcethatcreatedthisDocument

TOP

ThisDOSCommandIndexhasbeencreatedautomaticallybythefollowingDOSbatchscript:

@ECHOOFF
[Link]
SETLOCALENABLEEXTENSIONS
REM

[Link]

37/39

7/28/2015

DOSCommandIndex

REMCopyrightnote
[Link],whatsoever.
REMYoumayuseandmodifythescriptasyoulike,butkeeptheversionhistorywith
REMrecognitionto[Link]
REM
REMVersionHistory:
[Link]
SET"version=01.000"&:[Link],origin[Link]
SET"version=01.001"&:[Link]([Link]
SET"version=01.002"&:[Link]([Link]
SET"version=01.003"&:[Link]([Link]
SET"version=01.004"&:[Link]([Link]
SET"version=01.005"&:[Link]'"call"help',[Link]([Link]
SET"version=01.006"&:[Link]([Link]
SET"version=01.007"&:20080316p.h.usecodepage1252tosupporteuropeanusers([Link]
SET"version=02.000"&:[Link],avoidsmostescapecharacters([Link]
SET"version=02.000"&:[Link]
REM!!Foranewversionentry,copythelastentrydownandmodifyDate,AuthorandDescription
SET"version=%version:=%"
for/f"delims=:tokens=2"%%ain('chcp')doset"restore_codepage=%%a"
chcp1252>NUL
set"z=%~[Link]"
remecho.^<!DOCTYPEHTMLPUBLIC"//W3C//DTDHTML4.0Transitional//EN"^>>"%z%"
echo.^<!DOCTYPEhtmlPUBLIC"//W3C//DTDXHTML1.0Transitional//EN""[Link]
set"title=DOSCommandIndex"
for/f"tokens=*"%%ain('ver')doset"winver=%%a"
[Link]...
for%%Ain(
"<htmllang='enUS'xml:lang='enUS'xmlns='[Link]
"<head>"
"<styletype='text/css'>"
"h1{textalign:center;}"
"h2{textalign:center;}"
"[Link]{marginleft:auto;marginright:auto;}"
"td{textalign:left;}"
"[Link]{textalign:center;}"
"[Link]{background:#DDDDDD;}"
"[Link]{background:#F8F8FF;}"
"[Link]{float:right;}"
"</style>"
"<title>%title%</title>"
"<metahttpequiv='ContentType'content='text/html;charset=ISO88591'/>"
"</head>"
"<bodybgcolor='#FFFFCC'>"
"<fontcolor='darkblue'>"
"<h1>%title%</h1>"
"<divclass='center'>"
"<tableclass='center'border='1'cellspacing='1'cellpadding='3'>"
"<tr><td>WindowsVersion</td><td>:</td><td>%winver%</td></tr>"
"<tr><td>DocumentSource</td><td>:</td><td>"
"<ahref='[Link]
"<ahref='[Link]
"</td></tr>"
"<tr><td>Createdby</td><td>:</td><td><ahref='[Link]
"<b>%~nx0</b></a><br/><ahref='#%~n0'><b>SourceCodebelow</b></a></td></tr>"
"</table>"
"</div>"
"<br/><br/>"
"<tableclass='center'>"
)doecho.%%~A>>"%z%"

[Link]...
set/acnt=0
for/f"tokens=1,*"%%ain('"help|findstr/v/b/c:""/c:"Formore"/c:"SC""')do(

if"%%b"NEQ""(

for%%Ain(

"<tr><td><ahref='#%%a'>%%a</a></td><td>%%b</td></tr>"

)doecho.%%~A>>"%z%"

set/acnt+=1

)
)
for%%Ain(
"</table>"
"<br/><br/>"
)doecho.%%~A>>"%z%"
[Link]...
call:initProgresscnt
for/f"tokens=1,*"%%ain('"help|findstr/v/b/c:""/c:"Formore"/c:"SC""')do(

if"%%b"NEQ""(

[Link]%%a

for%%Ain(

"<divclass='top'><ahref='#'>TOP</a></div>"

"<h2><aname='%%a'>%%a</a></h2>"

"<divclass='helptext'><pre><xmp>"

)doecho.%%~A>>"%z%"

callhelp%%a>>"%z%"2>&1

echo^</xmp^>>>"%z%"

for%%Ain(

"</pre></div>"

)doecho.%%~A>>"%z%"

call:tickProgress

)
)
[Link]...

[Link]

38/39

7/28/2015

DOSCommandIndex

for%%Ain(
""
"<br/><br/>"
"<divclass='center'>"
"<divclass='top'><ahref='#'>TOP</a></div>"
"<aname='%~n0'><h2>DOSBatchScriptSourcethatcreatedthisDocument</h2></a>"
"This%title%hasbeencreatedautomaticallybythefollowingDOSbatchscript:"
"<br/><br/>"
"</div>"
"<divclass='sourcebatch'><pre><xmp>"
)doecho.%%~A>>"%z%"
type"%~f0">>"%z%"
[Link]...
echo^</xmp^>>>"%z%"
for%%Ain(
"</pre></div>"
""
"</font>"
"</body>"
"</html>"
)doecho.%%~A>>"%z%"
chcp%restore_codepage%>NUL
explorer"%z%"
:SKIP
[Link]
FOR/l%%ain(5,1,1)do(TITLE%title%closingin%%as&pingn2w1127.0.0.1>NUL)
TITLEPressanykeytoclosetheapplication&ECHO.&GOTO:EOF
::
::helperfunctionsfollowbelowhere
::
:initProgressinitializeaninternalprogresscounteranddisplaytheprogressinpercent
::%~1:inprogresscountermaximum,equalto100percent
::%~2:intitlestringformatter,defaultis'[P]completed.'
set/a"ProgressCnt=1"
set/a"ProgressMax=%~1"
set"ProgressFormat=%~2"
if"%ProgressFormat%"==""set"ProgressFormat=[PPPP]"
set"ProgressFormat=%ProgressFormat:[PPPP]=[P]completed.%"
call:tickProgress
GOTO:EOF
:tickProgressdisplaythenextprogresstick
set/a"ProgressCnt+=1"
SETLOCAL
set/a"per=100*ProgressCnt/ProgressMax"
set"per=%per%%%"
calltitle%%ProgressFormat:[P]=%per%%%
GOTO:EOF

[Link]

39/39

You might also like