DOS Command Index
DOS Command Index
DOS Command Index
DOSCommandIndex
DOSCommandIndex
WindowsVersion : MicrosoftWindows[Version6.1.7601]
DocumentSource :
http://www.dostips.com
http://www.dostips.com/DosCommandIndex.bat.php
Createdby
DosCommandIndex.bat
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
ConvertsFATvolumestoNTFS.Youcannotconvertthe
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
QuitstheCMD.EXEprogram(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.
http://www.dostips.com/DosCommandIndex.php
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)inbatchfilesorCONFIG.SYS.
Renamesafileorfiles.
Renamesafileorfiles.
Replacesfiles.
Removesadirectory.
Advancedutilitytocopyfilesanddirectorytrees
Displays,sets,orremovesWindowsenvironmentvariables.
Beginslocalizationofenvironmentchangesinabatchfile.
Shiftsthepositionofreplaceableparametersinbatchfiles.
Allowsproperlocalorremoteshutdownofmachine.
Sortsinput.
Startsaseparatewindowtorunaspecifiedprogramorcommand.
Associatesapathwithadriveletter.
Displaysmachinespecificpropertiesandconfiguration.
Displaysallcurrentlyrunningtasksincludingservices.
Killorstoparunningprocessorapplication.
Displaysorsetsthesystemtime.
SetsthewindowtitleforaCMD.EXEsession.
Graphicallydisplaysthedirectorystructureofadriveor
Displaysthecontentsofatextfile.
DisplaystheWindowsversion.
TellsWindowswhethertoverifythatyourfilesarewritten
Displaysadiskvolumelabelandserialnumber.
Copiesfilesanddirectorytrees.
DisplaysWMIinformationinsideinteractivecommandshell.
TOP
ASSOC
Displaysormodifiesfileextensionassociations
ASSOC[.ext[=[fileType]]]
.extSpecifiesthefileextensiontoassociatethefiletypewith
fileTypeSpecifiesthefiletypetoassociatewiththefileextension
TypeASSOCwithoutparameterstodisplaythecurrentfileassociations.
IfASSOCisinvokedwithjustafileextension,itdisplaysthecurrent
fileassociationforthatfileextension.Specifynothingforthefile
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
ThisispresentforCompatibilitywithDOSsystems.Ithasnoeffect
underWindows.
IfCommandExtensionsareenabled,andrunningontheWindows
platform,thentheBREAKcommandwillenterahardcodedbreakpoint
ifbeingdebuggedbyadebugger.
TOP
http://www.dostips.com/DosCommandIndex.php
2/39
7/28/2015
DOSCommandIndex
BCDEDIT
BCDEDITBootConfigurationDataStoreEditor
TheBcdedit.execommandlinetoolmodifiesthebootconfigurationdatastore.
Thebootconfigurationdatastorecontainsbootconfigurationparametersand
controlshowtheoperatingsystemisbooted.Theseparameterswerepreviously
intheBoot.inifile(inBIOSbasedoperatingsystems)orinthenonvolatile
RAMentries(inExtensibleFirmwareInterfacebasedoperatingsystems).Youcan
useBcdedit.exetoadd,delete,edit,andappendentriesintheboot
configurationdatastore.
Fordetailedcommandandoptioninformation,typebcdedit.exe/?<command>.For
example,todisplaydetailedinformationaboutthe/createstorecommand,type:
bcdedit.exe/?/createstore
Foranalphabeticallistoftopicsinthishelpfile,run"bcdedit/?TOPICS".
Commandsthatoperateonastore
================================
/createstoreCreatesanewandemptybootconfigurationdatastore.
/exportExportsthecontentsofthesystemstoretoafile.Thisfile
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
http://www.dostips.com/DosCommandIndex.php
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:
CALLcommandnowacceptslabelsasthetargetoftheCALL.Thesyntax
is:
CALL:labelarguments
Anewbatchfilecontextiscreatedwiththespecifiedargumentsand
controlispassedtothestatementafterthelabelspecified.Youmust
"exit"twicebyreachingtheendofthebatchscriptfiletwice.The
firsttimeyoureadtheend,controlwillreturntojustaftertheCALL
statement.Thesecondtimewillexitthebatchscript.TypeGOTO/?
foradescriptionoftheGOTO:EOFextensionthatwillallowyouto
http://www.dostips.com/DosCommandIndex.php
4/39
7/28/2015
DOSCommandIndex
"return"fromabatchscript.
Inaddition,expansionofbatchscriptargumentreferences(%0,%1,
etc.)havebeenchangedasfollows:
%*inabatchscriptreferstoallthearguments(e.g.%1%2%3
%4%5...)
Substitutionofbatchparameters(%n)hasbeenenhanced.Youcan
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
qualifiednameofthefirstonefound.Ifthe
environmentvariablenameisnotdefinedorthe
fileisnotfoundbythesearch,thenthis
modifierexpandstotheemptystring
Themodifierscanbecombinedtogetcompoundresults:
%~dp1expands%1toadriveletterandpathonly
%~nx1expands%1toafilenameandextensiononly
%~dp$PATH:1searchesthedirectorieslistedinthePATH
environmentvariablefor%1andexpandstothe
driveletterandpathofthefirstonefound.
%~ftza1expands%1toaDIRlikeoutputline
Intheaboveexamples%1andPATHcanbereplacedbyother
validvalues.The%~syntaxisterminatedbyavalidargument
number.The%~modifiersmaynotbeusedwith%*
CD
TOP
Displaysthenameoforchangesthecurrentdirectory.
CHDIR[/D][drive:][path]
CHDIR[..]
CD[/D][drive:][path]
CD[..]
..Specifiesthatyouwanttochangetotheparentdirectory.
TypeCDdrive:todisplaythecurrentdirectoryinthespecifieddrive.
TypeCDwithoutparameterstodisplaythecurrentdriveanddirectory.
Usethe/Dswitchtochangecurrentdriveinadditiontochangingcurrent
directoryforadrive.
IfCommandExtensionsareenabledCHDIRchangesasfollows:
Thecurrentdirectorystringisconvertedtousethesamecaseas
theondisknames.SoCDC:\TEMPwouldactuallysetthecurrent
directorytoC:\Tempifthatisthecaseondisk.
CHDIRcommanddoesnottreatspacesasdelimiters,soitispossibleto
CDintoasubdirectorynamethatcontainsaspacewithoutsurrounding
thenamewithquotes.Forexample:
cd\winnt\profiles\username\programs\startmenu
isthesameas:
cd"\winnt\profiles\username\programs\startmenu"
whichiswhatyouwouldhavetotypeifextensionsweredisabled.
CHCP
TOP
Displaysorsetstheactivecodepagenumber.
CHCP[nnn]
nnnSpecifiesacodepagenumber.
TypeCHCPwithoutaparametertodisplaytheactivecodepagenumber.
CHDIR
http://www.dostips.com/DosCommandIndex.php
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
theondisknames.SoCDC:\TEMPwouldactuallysetthecurrent
directorytoC:\Tempifthatisthecaseondisk.
CHDIRcommanddoesnottreatspacesasdelimiters,soitispossibleto
CDintoasubdirectorynamethatcontainsaspacewithoutsurrounding
thenamewithquotes.Forexample:
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
ofkilobytes.Ifsizeisnotspecified,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
specifiedamountoftimeinseconds.Iftimeisnot
specified,displaysthecurrentsetting.
/XExcludesadrivefromthedefaultboottimecheck.Excluded
drivesarenotaccumulatedbetweencommandinvocations.
/CSchedulesadrivetobecheckedatboottime;chkdskwillrun
ifthedriveisdirty.
Ifnoswitchesarespecified,CHKNTFSwilldisplayifthespecifieddriveis
dirtyorscheduledtobecheckedonnextreboot.
TOP
http://www.dostips.com/DosCommandIndex.php
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
delimiter.Forexample,/V:ONwouldallow!var!toexpandthe
variablevaratexecutiontime.Thevarsyntaxexpandsvariables
atinputtime,whichisquiteadifferentthingwheninsideofaFOR
loop.
/V:OFFDisabledelayedenvironmentexpansion.
Notethatmultiplecommandsseparatedbythecommandseparator'&&'
areacceptedforstringifsurroundedbyquotes.Also,forcompatibility
reasons,/Xisthesameas/E:ON,/Yisthesameas/E:OFFand/Risthe
sameas/C.Anyotherswitchesareignored.
If/Cor/Kisspecified,thentheremainderofthecommandlineafter
theswitchisprocessedasacommandline,wherethefollowinglogicis
usedtoprocessquote(")characters:
1.Ifallofthefollowingconditionsaremet,thenquotecharacters
onthecommandlinearepreserved:
no/Sswitch
exactlytwoquotecharacters
nospecialcharactersbetweenthetwoquotecharacters,
wherespecialisoneof:&<>()@^|
thereareoneormorewhitespacecharactersbetweenthe
twoquotecharacters
thestringbetweenthetwoquotecharactersisthename
ofanexecutablefile.
2.Otherwise,oldbehavioristoseeifthefirstcharacteris
aquotecharacterandifso,striptheleadingcharacterand
removethelastquotecharacteronthecommandline,preserving
anytextafterthelastquotecharacter.
If/DwasNOTspecifiedonthecommandline,thenwhenCMD.EXEstarts,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
CommandExtensionsareenabledbydefault.Youmayalsodisable
extensionsforaparticularinvocationbyusingthe/E:OFFswitch.You
canenableordisableextensionsforallinvocationsofCMD.EXEona
machineand/oruserlogonsessionbysettingeitherorbothofthe
followingREG_DWORDvaluesintheregistryusingREGEDIT.EXE:
HKEY_LOCAL_MACHINE\Software\Microsoft\CommandProcessor\EnableExtensions
and/or
HKEY_CURRENT_USER\Software\Microsoft\CommandProcessor\EnableExtensions
toeither0x1or0x0.Theuserspecificsettingtakesprecedenceover
themachinesetting.Thecommandlineswitchestakeprecedenceoverthe
registrysettings.
Inabatchfile,theSETLOCALENABLEEXTENSIONSorDISABLEEXTENSIONSarguments
takesprecedenceoverthe/E:ONor/E:OFFswitch.SeeSETLOCAL/?fordetails.
Thecommandextensionsinvolvechangesand/oradditionstothefollowing
commands:
DELorERASE
COLOR
CDorCHDIR
MDorMKDIR
PROMPT
http://www.dostips.com/DosCommandIndex.php
7/39
7/28/2015
DOSCommandIndex
PUSHD
POPD
SET
SETLOCAL
ENDLOCAL
IF
FOR
CALL
SHIFT
GOTO
START(alsoincludeschangestoexternalcommandinvocation)
ASSOC
FTYPE
Togetspecificdetails,typecommandname/?toviewthespecifics.
DelayedenvironmentvariableexpansionisNOTenabledbydefault.You
canenableordisabledelayedenvironmentvariableexpansionfora
particularinvocationofCMD.EXEwiththe/V:ONor/V:OFFswitch.You
canenableordisabledelayedexpansionforallinvocationsofCMD.EXEona
machineand/oruserlogonsessionbysettingeitherorbothofthe
followingREG_DWORDvaluesintheregistryusingREGEDIT.EXE:
HKEY_LOCAL_MACHINE\Software\Microsoft\CommandProcessor\DelayedExpansion
and/or
HKEY_CURRENT_USER\Software\Microsoft\CommandProcessor\DelayedExpansion
toeither0x1or0x0.Theuserspecificsettingtakesprecedenceover
themachinesetting.Thecommandlineswitchestakeprecedenceoverthe
registrysettings.
InabatchfiletheSETLOCALENABLEDELAYEDEXPANSIONorDISABLEDELAYEDEXPANSION
argumentstakesprecedenceoverthe/V:ONor/V:OFFswitch.SeeSETLOCAL/?
fordetails.
Ifdelayedenvironmentvariableexpansionisenabled,thentheexclamation
charactercanbeusedtosubstitutethevalueofanenvironmentvariable
atexecutiontime.
Youcanenableordisablefilenamecompletionforaparticular
invocationofCMD.EXEwiththe/F:ONor/F:OFFswitch.Youcanenable
ordisablecompletionforallinvocationsofCMD.EXEonamachineand/or
userlogonsessionbysettingeitherorbothofthefollowingREG_DWORD
valuesintheregistryusingREGEDIT.EXE:
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
settingstakeprecedenceoverthemachinesettings.Thecommandline
switchestakeprecedenceovertheregistrysettings.
Ifcompletionisenabledwiththe/F:ONswitch,thetwocontrol
charactersusedareCtrlDfordirectorynamecompletionandCtrlFfor
filenamecompletion.Todisableaparticularcompletioncharacterin
theregistry,usethevalueforspace(0x20)asitisnotavalid
controlcharacter.
Completionisinvokedwhenyoutypeeitherofthetwocontrol
characters.Thecompletionfunctiontakesthepathstringtotheleft
ofthecursorappendsawildcardcharactertoitifnoneisalready
presentandbuildsupalistofpathsthatmatch.Itthendisplaysthe
firstmatchingpath.Ifnopathsmatch,itjustbeepsandleavesthe
displayalone.Thereafter,repeatedpressingofthesamecontrol
characterwillcyclethroughthelistofmatchingpaths.Pressingthe
Shiftkeywiththecontrolcharacterwillmovethroughthelist
backwards.Ifyoueditthelineinanywayandpressthecontrol
characteragain,thesavedlistofmatchingpathsisdiscardedandanew
onegenerated.Thesameoccursifyouswitchbetweenfileanddirectory
namecompletion.Theonlydifferencebetweenthetwocontrolcharacters
isthefilecompletioncharactermatchesbothfileanddirectorynames,
whilethedirectorycompletioncharacteronlymatchesdirectorynames.
Iffilecompletionisusedonanyofthebuiltindirectorycommands
(CD,MDorRD)thendirectorycompletionisassumed.
Thecompletioncodedealscorrectlywithfilenamesthatcontainspaces
orotherspecialcharactersbyplacingquotesaroundthematchingpath.
Also,ifyoubackup,theninvokecompletionfromwithinaline,the
texttotherightofthecursoratthepointcompletionwasinvokedis
discarded.
Thespecialcharactersthatrequirequotesare:
<space>
&()[]{}^=;!'+,`~
COLOR
TOP
Setsthedefaultconsoleforegroundandbackgroundcolors.
COLOR[attr]
http://www.dostips.com/DosCommandIndex.php
8/39
7/28/2015
DOSCommandIndex
attrSpecifiescolorattributeofconsoleoutput
ColorattributesarespecifiedbyTWOhexdigitsthefirst
correspondstothebackground;thesecondtheforeground.Eachdigit
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
whenCMD.EXEstarted.Thisvalueeithercomesfromthecurrentconsole
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[...]]
/CCompressesthespecifiedfiles.Directorieswillbemarked
sothatfilesaddedafterwardwillbecompressed.
/UUncompressesthespecifiedfiles.Directorieswillbemarked
sothatfilesaddedafterwardwillnotbecompressed.
/SPerformsthespecifiedoperationonfilesinthegiven
directoryandallsubdirectories.Default"dir"isthe
currentdirectory.
/ADisplaysfileswiththehiddenorsystemattributes.These
filesareomittedbydefault.
/IContinuesperformingthespecifiedoperationevenaftererrors
haveoccurred.Bydefault,COMPACTstopswhenanerroris
encountered.
/FForcesthecompressoperationonallspecifiedfiles,even
thosewhicharealreadycompressed.Alreadycompressedfiles
areskippedbydefault.
/QReportsonlythemostessentialinformation.
filenameSpecifiesapattern,file,ordirectory.
Usedwithoutparameters,COMPACTdisplaysthecompressionstateof
thecurrentdirectoryandanyfilesitcontains.Youmayusemultiple
filenamesandwildcards.Youmustputspacesbetweenmultiple
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.
http://www.dostips.com/DosCommandIndex.php
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/Yonthecommandline.Defaultis
topromptonoverwritesunlessCOPYcommandisbeingexecutedfrom
withinabatchscript.
Toappendfiles,specifyasinglefilefordestination,butmultiplefiles
forsource(usingwildcardsorfile1+file2+file3format).
DATE
TOP
Displaysorsetsthedate.
DATE[/T|date]
TypeDATEwithoutparameterstodisplaythecurrentdatesettingand
apromptforanewone.PressENTERtokeepthesamedate.
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.
Wildcardsmaybeusedtodeletemultiplefiles.Ifa
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.
http://www.dostips.com/DosCommandIndex.php
10/39
7/28/2015
DOSCommandIndex
attributesDDirectoriesRReadonlyfiles
HHiddenfilesAFilesreadyforarchiving
SSystemfilesINotcontentindexedfiles
LReparsePointsPrefixmeaningnot
/BUsesbareformat(noheadinginformationorsummary).
/CDisplaythethousandseparatorinfilesizes.Thisisthe
default.Use/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
names.Theformatisthatof/Nwiththeshortnameinserted
beforethelongname.Ifnoshortnameispresent,blanksare
displayedinitsplace.
/4Displaysfourdigityears
SwitchesmaybepresetintheDIRCMDenvironmentvariable.Override
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:
$TCommandseparator.Allowsmultiplecommandsinamacro.
$1$9Batchparameters.Equivalentto%1%9inbatchprograms.
$*Symbolreplacedbyeverythingfollowingmacronameoncommandline.
http://www.dostips.com/DosCommandIndex.php
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"
shouldnotbedisplayed.Validfor
"TABLE"and"CSV"formatonly.
/SIProvidesinformationaboutsigneddrivers.
/VDisplaysverboseoutput.Notvalid
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.
Wildcardsmaybeusedtodeletemultiplefiles.Ifa
directoryisspecified,allfileswithinthedirectory
willbedeleted.
/PPromptsforconfirmationbeforedeletingeachfile.
/FForcedeletingofreadonlyfiles.
/SDeletespecifiedfilesfromallsubdirectories.
/QQuietmode,donotaskifoktodeleteonglobalwildcard
/ASelectsfilestodeletebasedonattributes
attributesRReadonlyfilesSSystemfiles
HHiddenfilesAFilesreadyforarchiving
http://www.dostips.com/DosCommandIndex.php
12/39
7/28/2015
DOSCommandIndex
INotcontentindexedFilesLReparsePoints
Prefixmeaningnot
IfCommandExtensionsareenabledDELandERASEchangeasfollows:
Thedisplaysemanticsofthe/Sswitcharereversedinthatitshows
youonlythefilesthataredeleted,nottheonesitcouldnotfind.
EXIT
TOP
QuitstheCMD.EXEprogram(commandinterpreter)orthecurrentbatch
script.
EXIT[/B][exitCode]
/Bspecifiestoexitthecurrentbatchscriptinsteadof
CMD.EXE.Ifexecutedfromoutsideabatchscript,it
willquitCMD.EXE
exitCodespecifiesanumericnumber.if/Bisspecified,sets
ERRORLEVELthatnumber.IfquittingCMD.EXE,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.
http://www.dostips.com/DosCommandIndex.php
13/39
7/28/2015
DOSCommandIndex
/XPrintslinesthatmatchexactly.
/VPrintsonlylinesthatdonotcontainamatch.
/NPrintsthelinenumberbeforeeachlinethatmatches.
/MPrintsonlythefilenameifafilecontainsamatch.
/OPrintscharacteroffsetbeforeeachmatchingline.
/PSkipfileswithnonprintablecharacters.
/OFF[LINE]Donotskipfileswithofflineattributeset.
/A:attrSpecifiescolorattributewithtwohexdigits.See"color/?"
/F:fileReadsfilelistfromthespecifiedfile(/standsforconsole).
/C:stringUsesspecifiedstringasaliteralsearchstring.
/G:fileGetssearchstringsfromthespecifiedfile(/standsforconsole).
/D:dirSearchasemicolondelimitedlistofdirectories
stringsTexttobesearchedfor.
[drive:][path]filename
Specifiesafileorfilestosearch.
Usespacestoseparatemultiplesearchstringsunlesstheargumentisprefixed
with/C.Forexample,'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)Specifiesasetofoneormorefiles.Wildcardsmaybeused.
commandSpecifiesthecommandtocarryoutforeachfile.
commandparameters
Specifiesparametersorswitchesforthespecifiedcommand.
TousetheFORcommandinabatchprogram,specify%%variableinstead
of%variable.Variablenamesarecasesensitive,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
statementineachdirectoryofthetree.Ifnodirectory
specificationisspecifiedafter/Rthenthecurrentdirectoryis
assumed.Ifsetisjustasingleperiod(.)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]
filesetisoneormorefilenames.Eachfileisopened,read
andprocessedbeforegoingontothenextfileinfileset.
Processingconsistsofreadinginthefile,breakingitupinto
individuallinesoftextandthenparsingeachlineintozeroor
moretokens.Thebodyoftheforloopisthencalledwiththe
variablevalue(s)settothefoundtokenstring(s).Bydefault,/F
passesthefirstblankseparatedtokenfromeachlineofeachfile.
Blanklinesareskipped.Youcanoverridethedefaultparsing
behaviorbyspecifyingtheoptional"options"parameter.This
isaquotedstringwhichcontainsoneormorekeywordstospecify
differentparsingoptions.Thekeywordsare:
eol=cspecifiesanendoflinecommentcharacter
(justone)
http://www.dostips.com/DosCommandIndex.php
14/39
7/28/2015
DOSCommandIndex
skip=nspecifiesthenumberoflinestoskipatthe
beginningofthefile.
delims=xxxspecifiesadelimiterset.Thisreplacesthe
defaultdelimitersetofspaceandtab.
tokens=x,y,mnspecifieswhichtokensfromeachlineareto
bepassedtotheforbodyforeachiteration.
Thiswillcauseadditionalvariablenamesto
beallocated.Themnformisarange,
specifyingthemththroughthenthtokens.If
thelastcharacterinthetokens=stringisan
asterisk,thenanadditionalvariableis
allocatedandreceivestheremainingtexton
thelineafterthelasttokenparsed.
usebackqspecifiesthatthenewsemanticsareinforce,
whereabackquotedstringisexecutedasa
commandandasinglequotedstringisa
literalstringcommandandallowstheuseof
doublequotestoquotefilenamesin
fileset.
Someexamplesmighthelp:
FOR/F"eol=;tokens=2,3*delims=,"%iin(myfile.txt)do@echo%i%j%k
wouldparseeachlineinmyfile.txt,ignoringlinesthatbeginwith
asemicolon,passingthe2ndand3rdtokenfromeachlinetothefor
body,withtokensdelimitedbycommasand/orspaces.Noticethefor
bodystatementsreference%itogetthe2ndtoken,%jtogetthe
3rdtoken,and%ktogetallremainingtokensafterthe3rd.For
filenamesthatcontainspaces,youneedtoquotethefilenameswith
doublequotes.Inordertousedoublequotesinthismanner,youalso
needtousetheusebackqoption,otherwisethedoublequoteswillbe
interpretedasdefiningaliteralstringtoparse.
%iisexplicitlydeclaredintheforstatementandthe%jand%k
areimplicitlydeclaredviathetokens=option.Youcanspecifyup
to26tokensviathetokens=line,provideditdoesnotcausean
attempttodeclareavariablehigherthantheletter'z'or'Z'.
Remember,FORvariablesaresingleletter,casesensitive,global,
andyoucan'thavemorethan52totalactiveatanyonetime.
YoucanalsousetheFOR/Fparsinglogiconanimmediatestring,by
makingthefilesetbetweentheparenthesisaquotedstring,
usingsinglequotecharacters.Itwillbetreatedasasingleline
ofinputfromafileandparsed.
Finally,youcanusetheFOR/Fcommandtoparsetheoutputofa
command.Youdothisbymakingthefilesetbetweenthe
parenthesisabackquotedstring.Itwillbetreatedasacommand
line,whichispassedtoachildCMD.EXEandtheoutputiscaptured
intomemoryandparsedasifitwasafile.Sothefollowing
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
values.The%~syntaxisterminatedbyavalidFORvariablename.
Pickinguppercasevariablenameslike%Imakesitmorereadableand
avoidsconfusionwiththemodifiers,whicharenotcasesensitive.
FORMAT
TOP
FormatsadiskforusewithWindows.
http://www.dostips.com/DosCommandIndex.php
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.
/QPerformsaquickformat.Notethatthisswitchoverrides/P.
/CNTFSonly:Filescreatedonthenewvolumewillbecompressed
bydefault.
/XForcesthevolumetodismountfirstifnecessary.Allopened
handlestothevolumewouldnolongerbevalid.
/R:revisionUDFonly:ForcestheformattoaspecificUDFversion
(1.02,1.50,2.00,2.01,2.50).Thedefault
revisionis2.01.
/DUDF2.50only:Metadatawillbeduplicated.
/A:sizeOverridesthedefaultallocationunitsize.Defaultsettings
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:passesZeroeverysectoronthevolumepassestimes.Thisswitchis
notvalidwith/Q
/S:stateWhere"state"iseither"enable"or"disable"
Shortnamesareenabledbydefault
FSUTIL
TOP
TheFSUTILutilityrequiresthatyouhaveadministrativeprivileges.
FTYPE
TOP
Displaysormodifiesfiletypesusedinfileextensionassociations
FTYPE[fileType[=[openCommandString]]]
fileTypeSpecifiesthefiletypetoexamineorchange
openCommandStringSpecifiestheopencommandtousewhenlaunchingfiles
ofthistype.
TypeFTYPEwithoutparameterstodisplaythecurrentfiletypesthat
haveopencommandstringsdefined.FTYPEisinvokedwithjustafile
type,itdisplaysthecurrentopencommandstringforthatfiletype.
SpecifynothingfortheopencommandstringandtheFTYPEcommandwill
deletetheopencommandstringforthefiletype.Withinanopen
commandstring%0or%1aresubstitutedwiththefilenamebeing
launchedthroughtheassocation.%*getsalltheparametersand%2
getsthe1stparameter,%3thesecond,etc.%~ngetsalltheremaining
parametersstartingwiththenthparameter,wherenmaybebetween2and9,
inclusive.Forexample:
ASSOC.pl=PerlScript
FTYPEPerlScript=perl.exe%1%*
wouldallowyoutoinvokeaPerlscriptasfollows:
script.pl123
Ifyouwanttoeliminatetheneedtotypetheextensions,thendothe
following:
setPATHEXT=.pl;%PATHEXT%
andthescriptcouldbeinvokedasfollows:
script123
http://www.dostips.com/DosCommandIndex.php
16/39
7/28/2015
DOSCommandIndex
GOTO
TOP
Directscmd.exetoalabeledlineinabatchprogram.
GOTOlabel
labelSpecifiesatextstringusedinthebatchprogramasalabel.
Youtypealabelonalinebyitself,beginningwithacolon.
IfCommandExtensionsareenabledGOTOchangesasfollows:
GOTOcommandnowacceptsatargetlabelof:EOFwhichtransferscontrol
totheendofthecurrentbatchscriptfile.Thisisaneasywayto
exitabatchscriptfilewithoutdefiningalabel.TypeCALL/?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
context.Promptsforinputifomitted.
/SCOPEscopeSpecifieswhethertheuserorthe
computersettingsneedstobedisplayed.
Validvalues:"USER","COMPUTER".
/USER[domain\]userSpecifiestheusernameforwhichthe
RSOPdataistobedisplayed.
/RDisplaysRSoPsummarydata.
/VSpecifiesthatverboseinformationshould
bedisplayed.Verboseinformationprovides
additionaldetailedsettingsthathave
beenappliedwithaprecedenceof1.
/ZSpecifiesthatthesuperverbose
informationshouldbedisplayed.Super
verboseinformationprovidesadditional
detailedsettingsthathavebeenapplied
withaprecedenceof1andhigher.This
allowsyoutoseeifasettingwassetin
multipleplaces.SeetheGroupPolicy
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.
http://www.dostips.com/DosCommandIndex.php
17/39
7/28/2015
DOSCommandIndex
ICACLSname/saveaclfile[/T][/C][/L][/Q]
storestheDACLsforthefilesandfoldersthatmatchthename
intoaclfileforlaterusewith/restore.NotethatSACLs,
owner,orintegritylabelsarenotsaved.
ICACLSdirectory[/substituteSidOldSidNew[...]]/restoreaclfile
[/C][/L][/Q]
appliesthestoredDACLstofilesindirectory.
ICACLSname/setowneruser[/T][/C][/L][/Q]
changestheownerofallmatchingnames.Thisoptiondoesnot
forceachangeofownership;usethetakeown.exeutilityfor
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:permgrantsthespecifieduseraccessrights.With:r,
thepermissionsreplaceanyprevioulygrantedexplicitpermissions.
Without:r,thepermissionsareaddedtoanypreviouslygranted
explicitpermissions.
/denySid:permexplicitlydeniesthespecifieduseraccessrights.
AnexplicitdenyACEisaddedforthestatedpermissionsand
thesamepermissionsinanyexplicitgrantareremoved.
/remove[:[g|d]]SidremovesalloccurrencesofSidintheACL.With
:g,itremovesalloccurrencesofgrantedrightstothatSid.With
:d,itremovesalloccurrencesofdeniedrightstothatSid.
/setintegritylevel[(CI)(OI)]Levelexplicitlyaddsanintegrity
ACEtoallmatchingfiles.Thelevelistobespecifiedasone
of:
L[ow]
M[edium]
H[igh]
InheritanceoptionsfortheintegrityACEmayprecedethelevel
andareappliedonlytodirectories.
/inheritance:e|d|r
eenablesinheritance
ddisablesinheritanceandcopytheACEs
rremoveallinheritedACEs
Note:
Sidsmaybeineithernumericalorfriendlynameform.Ifanumerical
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
http://www.dostips.com/DosCommandIndex.php
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
met.CommandcanbefollowedbyELSEcommandwhich
willexecutethecommandaftertheELSEkeywordifthe
specifiedconditionisFALSE
TheELSEclausemustoccuronthesamelineasthecommandaftertheIF.For
example:
IFEXISTfilename.(
delfilename.
)ELSE(
echofilename.missing.
)
ThefollowingwouldNOTworkbecausethedelcommandneedstobeterminated
byanewline:
IFEXISTfilename.delfilename.ELSEechofilename.missing
Norwouldthefollowingwork,sincetheELSEcommandmustbeonthesameline
astheendoftheIFcommand:
IFEXISTfilename.delfilename.
ELSEechofilename.missing
Thefollowingwouldworkifyouwantitallononeline:
IFEXISTfilename.(delfilename.)ELSEechofilename.missing
IfCommandExtensionsareenabledIFchangesasfollows:
IF[/I]string1compareopstring2command
IFCMDEXTVERSIONnumbercommand
IFDEFINEDvariablecommand
wherecompareopmaybeoneof:
EQUequal
NEQnotequal
LSSlessthan
LEQlessthanorequal
GTRgreaterthan
GEQgreaterthanorequal
http://www.dostips.com/DosCommandIndex.php
19/39
7/28/2015
DOSCommandIndex
andthe/Iswitch,ifspecified,saystodocaseinsensitivestring
compares.The/Iswitchcanalsobeusedonthestring1==string2form
ofIF.Thesecomparisonsaregeneric,inthatifbothstring1and
string2arebothcomprisedofallnumericdigits,thenthestringsare
convertedtonumbersandanumericcomparisonisperformed.
TheCMDEXTVERSIONconditionalworksjustlikeERRORLEVEL,exceptitis
comparingagainstaninternalversionnumberassociatedwiththeCommand
Extensions.Thefirstversionis1.Itwillbeincrementedbyonewhen
significantenhancementsareaddedtotheCommandExtensions.
CMDEXTVERSIONconditionalisnevertruewhenCommandExtensionsare
disabled.
TheDEFINEDconditionalworksjustlikeEXISTexceptittakesan
environmentvariablenameandreturnstrueiftheenvironmentvariable
isdefined.
%ERRORLEVEL%willexpandintoastringrepresentationof
thecurrentvalueofERRORLEVEL,providedthatthereisnotalready
anenvironmentvariablewiththenameERRORLEVEL,inwhichcaseyou
willgetitsvalueinstead.Afterrunningaprogram,thefollowing
illustratesERRORLEVELuse:
gotoanswer%ERRORLEVEL%
:answer0
echoProgramhadreturncode0
:answer1
echoProgramhadreturncode1
Youcanalsousenumericalcomparisonsabove:
IF%ERRORLEVEL%LEQ1gotookay
%CMDCMDLINE%willexpandintotheoriginalcommandlinepassedto
CMD.EXEpriortoanyprocessingbyCMD.EXE,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,orvolumename.Ifvolumenameisspecified,
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
http://www.dostips.com/DosCommandIndex.php
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
/DCreatesadirectorysymboliclink.Defaultisafile
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
filesListoffilestobedisplayed.Filesinthelist
areseparatedbyblanks.
Ifextendedfeaturesareenabled,thefollowingcommands
areacceptedattheMoreprompt:
PnDisplaynextnlines
SnSkipnextnlines
http://www.dostips.com/DosCommandIndex.php
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.
destinationSpecifiesthenewlocationofthefile.Destination
canconsistofadriveletterandcolon,a
directoryname,oracombination.Ifyouaremoving
onlyonefile,youcanalsoincludeafilenameif
youwanttorenamethefilewhenyoumoveit.
[drive:][path]dirname1Specifiesthedirectoryyouwanttorename.
dirname2Specifiesthenewnameofthedirectory.
/YSuppressespromptingtoconfirmyouwantto
overwriteanexistingdestinationfile.
/YCausespromptingtoconfirmyouwanttooverwrite
anexistingdestinationfile.
Theswitch/YmaybepresentintheCOPYCMDenvironmentvariable.
Thismaybeoverriddenwith/Yonthecommandline.Defaultis
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;toclearallsearchpathsettingsanddirectcmd.exetosearch
onlyinthecurrentdirectory.
TypePATHwithoutparameterstodisplaythecurrentpath.
Including%PATH%inthenewpathsettingcausestheoldpathtobe
appendedtothenewsetting.
PAUSE
TOP
POPD
TOP
Suspendsprocessingofabatchprogramanddisplaysthemessage
Pressanykeytocontinue...
http://www.dostips.com/DosCommandIndex.php
22/39
7/28/2015
DOSCommandIndex
ChangestothedirectorystoredbythePUSHDcommand.
POPD
IfCommandExtensionsareenabledthePOPDcommandwilldelete
anytemporarydrivelettercreatedbyPUSHDwhenyouPOPDthat
driveoffthepusheddirectorystack.
TOP
PROMPT
TOP
Printsatextfile.
PRINT[/D:device][[drive:][path]filename[...]]
/D:deviceSpecifiesaprintdevice.
Changesthecmd.execommandprompt.
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
defineddriveletter.Temporarydrivelettersareallocatedfrom
Z:ondown,usingthefirstunuseddriveletterfound.
RD
TOP
Removes(deletes)adirectory.
RMDIR[/S][/Q][drive:]path
RD[/S][/Q][drive:]path
/SRemovesalldirectoriesandfilesinthespecifieddirectory
inadditiontothedirectoryitself.Usedtoremoveadirectory
tree.
http://www.dostips.com/DosCommandIndex.php
23/39
7/28/2015
DOSCommandIndex
/QQuietmode,donotaskifoktoremoveadirectorytreewith/S
RECOVER
TOP
REM
TOP
REN
TOP
Recoversreadableinformationfromabadordefectivedisk.
RECOVER[drive:][path]filename
ConsulttheonlineCommandReferenceinWindowsHelp
beforeusingtheRECOVERcommand.
Recordscomments(remarks)inabatchfileorCONFIG.SYS.
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.
/AAddsnewfilestodestinationdirectory.Cannot
usewith/Sor/Uswitches.
/PPromptsforconfirmationbeforereplacingafileor
addingasourcefile.
/RReplacesreadonlyfilesaswellasunprotected
files.
/SReplacesfilesinallsubdirectoriesofthe
destinationdirectory.Cannotusewiththe/A
switch.
/WWaitsforyoutoinsertadiskbeforebeginning.
/UReplaces(updates)onlyfilesthatareolderthan
sourcefiles.Cannotusewiththe/Aswitch.
RMDIR
TOP
Removes(deletes)adirectory.
RMDIR[/S][/Q][drive:]path
RD[/S][/Q][drive:]path
/SRemovesalldirectoriesandfilesinthespecifieddirectory
inadditiontothedirectoryitself.Usedtoremoveadirectory
tree.
/QQuietmode,donotaskifoktoremoveadirectorytreewith/S
ROBOCOPY
http://www.dostips.com/DosCommandIndex.php
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.
http://www.dostips.com/DosCommandIndex.php
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,orremovescmd.exeenvironmentvariables.
SET[variable=[string]]
variableSpecifiestheenvironmentvariablename.
stringSpecifiesaseriesofcharacterstoassigntothevariable.
TypeSETwithoutparameterstodisplaythecurrentenvironmentvariables.
IfCommandExtensionsareenabledSETchangesasfollows:
SETcommandinvokedwithjustavariablename,noequalsignorvalue
willdisplaythevalueofallvariableswhoseprefixmatchesthename
giventotheSETcommand.Forexample:
SETP
woulddisplayallvariablesthatbeginwiththeletter'P'
SETcommandwillsettheERRORLEVELto1ifthevariablenameisnot
foundinthecurrentenvironment.
SETcommandwillnotallowanequalsigntobepartofthenameof
avariable.
TwonewswitcheshavebeenaddedtotheSETcommand:
SET/Aexpression
SET/Pvariable=[promptString]
The/Aswitchspecifiesthatthestringtotherightoftheequalsign
isanumericalexpressionthatisevaluated.Theexpressionevaluator
isprettysimpleandsupportsthefollowingoperations,indecreasing
orderofprecedence:
()grouping
!~unaryoperators
*/%arithmeticoperators
+arithmeticoperators
<<>>logicalshift
&bitwiseand
^bitwiseexclusiveor
|bitwiseor
=*=/=%=+==assignment
&=^=|=<<=>>=
http://www.dostips.com/DosCommandIndex.php
26/39
7/28/2015
DOSCommandIndex
,expressionseparator
Ifyouuseanyofthelogicalormodulusoperators,youwillneedto
enclosetheexpressionstringinquotes.Anynonnumericstringsinthe
expressionaretreatedasenvironmentvariablenameswhosevaluesare
convertedtonumbersbeforeusingthem.Ifanenvironmentvariablename
isspecifiedbutisnotdefinedinthecurrentenvironment,thenavalue
ofzeroisused.Thisallowsyoutodoarithmeticwithenvironment
variablevalueswithouthavingtotypeallthose%signstogettheir
values.IfSET/Aisexecutedfromthecommandlineoutsideofa
commandscript,thenitdisplaysthefinalvalueoftheexpression.The
assignmentoperatorrequiresanenvironmentvariablenametotheleftof
theassignmentoperator.Numericvaluesaredecimalnumbers,unless
prefixedby0xforhexadecimalnumbers,and0foroctalnumbers.
So0x12isthesameas18isthesameas022.Pleasenotethattheoctal
notationcanbeconfusing:08and09arenotvalidnumbersbecause8and
9arenotvalidoctaldigits.
The/Pswitchallowsyoutosetthevalueofavariabletoalineofinput
enteredbytheuser.DisplaysthespecifiedpromptStringbeforereading
thelineofinput.ThepromptStringcanbeempty.
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
result.Ifthelengthisnotspecified,thenitdefaultstothe
remainderofthevariablevalue.Ifeithernumber(offsetorlength)is
negative,thenthenumberusedisthelengthoftheenvironmentvariable
valueaddedtotheoffsetorlengthspecified.
%PATH:~10%
wouldextractthelast10charactersofthePATHvariable.
%PATH:~0,2%
wouldextractallbutthelast2charactersofthePATHvariable.
Finally,supportfordelayedenvironmentvariableexpansionhasbeen
added.Thissupportisalwaysdisabledbydefault,butmaybe
enabled/disabledviathe/VcommandlineswitchtoCMD.EXE.SeeCMD/?
Delayedenvironmentvariableexpansionisusefulforgettingaround
thelimitationsofthecurrentexpansionwhichhappenswhenaline
oftextisread,notwhenitisexecuted.Thefollowingexample
demonstratestheproblemwithimmediatevariableexpansion:
setVAR=before
if"%VAR%"=="before"(
setVAR=after
if"%VAR%"=="after"@echoIfyouseethis,itworked
)
wouldneverdisplaythemessage,sincethe%VAR%inBOTHIFstatements
issubstitutedwhenthefirstIFstatementisread,sinceitlogically
includesthebodyoftheIF,whichisacompoundstatement.Sothe
IFinsidethecompoundstatementisreallycomparing"before"with
"after"whichwillneverbeequal.Similarly,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
executiontime.Ifdelayedvariableexpansionisenabled,theabove
examplescouldbewrittenasfollowstoworkasintended:
setVAR=before
if"%VAR%"=="before"(
setVAR=after
if"!VAR!"=="after"@echoIfyouseethis,itworked
)
setLIST=
for%iin(*)dosetLIST=!LIST!%i
echo%LIST%
http://www.dostips.com/DosCommandIndex.php
27/39
7/28/2015
DOSCommandIndex
IfCommandExtensionsareenabled,thenthereareseveraldynamic
environmentvariablesthatcanbeexpandedbutwhichdon'tshowupin
thelistofvariablesdisplayedbySET.Thesevariablevaluesare
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
Beginslocalizationofenvironmentchangesinabatchfile.Environment
changesmadeafterSETLOCALhasbeenissuedarelocaltothebatchfile.
ENDLOCALmustbeissuedtorestoretheprevioussettings.Whentheend
ofabatchscriptisreached,animpliedENDLOCALisexecutedforany
outstandingSETLOCALcommandsissuedbythatbatchscript.
SETLOCAL
IfCommandExtensionsareenabledSETLOCALchangesasfollows:
SETLOCALbatchcommandnowacceptsoptionalarguments:
ENABLEEXTENSIONS/DISABLEEXTENSIONS
enableordisablecommandprocessorextensions.These
argumentstakesprecedenceovertheCMD/E:ONor/E:OFF
switches.SeeCMD/?fordetails.
ENABLEDELAYEDEXPANSION/DISABLEDELAYEDEXPANSION
enableordisabledelayedenvironmentvariable
expansion.TheseargumentstakesprecedenceovertheCMD
/V:ONor/V:OFFswitches.SeeCMD/?fordetails.
ThesemodificationslastuntilthematchingENDLOCALcommand,
regardlessoftheirsettingpriortotheSETLOCALcommand.
TheSETLOCALcommandwillsettheERRORLEVELvalueifgiven
anargument.Itwillbezeroifoneofthetwovalidarguments
isgivenandoneotherwise.Youcanusethisinbatchscripts
todetermineiftheextensionsareavailable,usingthefollowing
technique:
VERIFYOTHER2>nul
SETLOCALENABLEEXTENSIONS
IFERRORLEVEL1echoUnabletoenableextensions
ThisworksbecauseonoldversionsofCMD.EXE,SETLOCALdoesNOT
settheERRORLEVELvalue.TheVERIFYcommandwithabadargument
initializestheERRORLEVELvaluetoanonzerovalue.
SHIFT
TOP
Changesthepositionofreplaceableparametersinabatchfile.
SHIFT[/n]
IfCommandExtensionsareenabledtheSHIFTcommandsupports
the/nswitchwhichtellsthecommandtostartshiftingatthe
nthargument,wherenmaybebetweenzeroandeight.Forexample:
SHIFT/2
wouldshift%3to%2,%4to%3,etc.andleave%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"]]
NoargsDisplayhelp.Thisisthesameastyping/?.
/?Displayhelp.Thisisthesameasnottypinganyoptions.
/iDisplaythegraphicaluserinterface(GUI).
Thismustbethefirstoption.
/lLogoff.Thiscannotbeusedwith/mor/doptions.
http://www.dostips.com/DosCommandIndex.php
28/39
7/28/2015
DOSCommandIndex
/sShutdownthecomputer.
/rShutdownandrestartthecomputer.
/gShutdownandrestartthecomputer.Afterthesystemis
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
characterineachline.Lineswithfewer
thanncharacterscollatebeforeotherlines.
Bydefaultcomparisonsstartatthefirst
characterineachline.
/L[OCALE]localeOverridesthesystemdefaultlocalewith
thespecifiedone.The""C""localeyields
thefastestcollatingsequenceandis
currentlytheonlyalternative.Thesort
isalwayscaseinsensitive.
/M[EMORY]kilobytesSpecifiesamountofmainmemorytousefor
http://www.dostips.com/DosCommandIndex.php
29/39
7/28/2015
DOSCommandIndex
thesort,inkilobytes.Thememorysizeis
alwaysconstrainedtobeaminimumof160
kilobytes.Ifthememorysizeisspecified
theexactamountwillbeusedforthesort,
regardlessofhowmuchmainmemoryis
available.
Thebestperformanceisusuallyachievedby
notspecifyingamemorysize.Bydefaultthe
sortwillbedonewithonepass(notemporary
file)ifitfitsinthedefaultmaximum
memorysize,otherwisethesortwillbedone
intwopasses(withthepartiallysorteddata
beingstoredinatemporaryfile)suchthat
theamountsofmemoryusedforboththesort
andmergepassesareequal.Thedefault
maximummemorysizeis90%ofavailablemain
memoryifboththeinputandoutputare
files,and45%ofmainmemoryotherwise.
/REC[ORD_MAXIMUM]charactersSpecifiesthemaximumnumberofcharacters
inarecord(default4096,maximum65535).
/R[EVERSE]Reversesthesortorder;thatis,
sortsZtoA,then9to0.
[drive1:][path1]filename1Specifiesthefiletobesorted.Ifnot
specified,thestandardinputissorted.
Specifyingtheinputfileisfasterthan
redirectingthesamefileasstandardinput.
/T[EMPORARY]
[drive2:][path2]Specifiesthepathofthedirectorytohold
thesort'sworkingstorage,incasethedata
doesnotfitinmainmemory.Thedefaultis
tousethesystemtemporarydirectory.
/O[UTPUT]
[drive3:][path3]filename3Specifiesthefilewherethesortedinputis
tobestored.Ifnotspecified,thedatais
writtentothestandardoutput.Specifying
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.
BStartapplicationwithoutcreatinganewwindow.The
applicationhas^Chandlingignored.Unlesstheapplication
enables^Cprocessing,^Breakistheonlywaytointerrupt
theapplication.
IThenewenvironmentwillbetheoriginalenvironmentpassed
tothecmd.exeandnotthecurrentenvironment.
MINStartwindowminimized.
MAXStartwindowmaximized.
http://www.dostips.com/DosCommandIndex.php
30/39
7/28/2015
DOSCommandIndex
SEPARATEStart16bitWindowsprograminseparatememoryspace.
SHAREDStart16bitWindowsprograminsharedmemoryspace.
LOWStartapplicationintheIDLEpriorityclass.
NORMALStartapplicationintheNORMALpriorityclass.
HIGHStartapplicationintheHIGHpriorityclass.
REALTIMEStartapplicationintheREALTIMEpriorityclass.
ABOVENORMALStartapplicationintheABOVENORMALpriorityclass.
BELOWNORMALStartapplicationintheBELOWNORMALpriorityclass.
NODESpecifiesthepreferredNonUniformMemoryArchitecture(NUMA)
nodeasadecimalinteger.
AFFINITYSpecifiestheprocessoraffinitymaskasahexadecimalnumber.
Theprocessisrestrictedtorunningontheseprocessors.
Theaffinitymaskisinterpreteddifferentlywhen/AFFINITYand
/NODEarecombined.SpecifytheaffinitymaskasiftheNUMA
node'sprocessormaskisrightshiftedtobeginatbitzero.
Theprocessisrestrictedtorunningonthoseprocessorsin
commonbetweenthespecifiedaffinitymaskandtheNUMAnode.
Ifnoprocessorsareincommon,theprocessisrestrictedto
runningonthespecifiedNUMAnode.
WAITStartapplicationandwaitforittoterminate.
command/program
Ifitisaninternalcmdcommandorabatchfilethen
thecommandprocessorisrunwiththe/Kswitchtocmd.exe.
Thismeansthatthewindowwillremainafterthecommand
hasbeenrun.
Ifitisnotaninternalcmdcommandorbatchfilethen
itisaprogramandwillrunaseitherawindowedapplication
oraconsoleapplication.
parametersThesearetheparameterspassedtothecommand/program.
NOTE:TheSEPARATEandSHAREDoptionsarenotsupportedon64bitplatforms.
Specifying/NODEallowsprocessestobecreatedinawaythatleveragesmemory
localityonNUMAsystems.Forexample,twoprocessesthatcommunicatewith
eachotherheavilythroughsharedmemorycanbecreatedtosharethesame
preferredNUMAnodeinordertominimizememorylatencies.Theyallocate
memoryfromthesameNUMAnodewhenpossible,andtheyarefreetorunon
processorsoutsidethespecifiednode.
start/NODE1application1.exe
start/NODE1application2.exe
Thesetwoprocessescanbefurtherconstrainedtorunonspecificprocessors
withinthesameNUMAnode.Inthefollowingexample,application1runsonthe
lowordertwoprocessorsofthenode,whileapplication2runsonthenexttwo
processorsofthenode.Thisexampleassumesthespecifiednodehasatleast
fourlogicalprocessors.Notethatthenodenumbercanbechangedtoanyvalid
nodenumberforthatcomputerwithouthavingtochangetheaffinitymask.
start/NODE1/AFFINITY0x3application1.exe
start/NODE1/AFFINITY0xcapplication2.exe
IfCommandExtensionsareenabled,externalcommandinvocation
throughthecommandlineortheSTARTcommandchangesasfollows:
nonexecutablefilesmaybeinvokedthroughtheirfileassociationjust
bytypingthenameofthefileasacommand.(e.g.WORD.DOCwould
launchtheapplicationassociatedwiththe.DOCfileextension).
SeetheASSOCandFTYPEcommandsforhowtocreatethese
associationsfromwithinacommandscript.
Whenexecutinganapplicationthatisa32bitGUIapplication,CMD.EXE
doesnotwaitfortheapplicationtoterminatebeforereturningto
thecommandprompt.ThisnewbehaviordoesNOToccurifexecuting
withinacommandscript.
Whenexecutingacommandlinewhosefirsttokenisthestring"CMD"
withoutanextensionorpathqualifier,then"CMD"isreplacedwith
thevalueoftheCOMSPECvariable.ThispreventspickingupCMD.EXE
fromthecurrentdirectory.
WhenexecutingacommandlinewhosefirsttokendoesNOTcontainan
extension,thenCMD.EXEusesthevalueofthePATHEXT
environmentvariabletodeterminewhichextensionstolookfor
andinwhatorder.ThedefaultvalueforthePATHEXTvariable
is:
.COM;.EXE;.BAT;.CMD
NoticethesyntaxisthesameasthePATHvariable,with
semicolonsseparatingthedifferentelements.
Whensearchingforanexecutable,ifthereisnomatchonanyextension,
thenlookstoseeifthenamematchesadirectoryname.Ifitdoes,the
STARTcommandlaunchestheExploreronthatpath.Ifdonefromthe
commandline,itistheequivalenttodoingaCD/Dtothatpath.
SUBST
TOP
Associatesapathwithadriveletter.
SUBST[drive1:[drive2:]path]
SUBSTdrive1:/D
drive1:Specifiesavirtualdrivetowhichyouwanttoassignapath.
http://www.dostips.com/DosCommandIndex.php
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
usercontext.Promptsforinputifomitted.
/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
usercontext.Promptsforinputifomitted.
/M[module]Listsalltaskscurrentlyusingthegiven
exe/dllname.Ifthemodulenameisnot
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,
http://www.dostips.com/DosCommandIndex.php
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
context.Promptsforinputifomitted.
/FIfilterAppliesafiltertoselectasetoftasks.
Allows"*"tobeused.ex.imagenameeqacme*
/PIDprocessidSpecifiesthePIDoftheprocesstobeterminated.
UseTaskListtogetthePID.
/IMimagenameSpecifiestheimagenameoftheprocess
tobeterminated.Wildcard'*'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/IMnotepad.exe
TASKKILL/PID1230/PID1241/PID1253/T
TASKKILL/F/IMcmd.exe/T
TASKKILL/F/FI"PIDge1000"/FI"WINDOWTITLEneuntitle*"
TASKKILL/F/FI"USERNAMEeqNTAUTHORITY\SYSTEM"/IMnotepad.exe
TASKKILL/Ssystem/Udomain\username/FI"USERNAMEneNT*"/IM*
TASKKILL/Ssystem/Uusername/Ppassword/FI"IMAGENAMEeqnote*"
TIME
http://www.dostips.com/DosCommandIndex.php
TOP
33/39
7/28/2015
DOSCommandIndex
Displaysorsetsthesystemtime.
TIME[/T|time]
TypeTIMEwithnoparameterstodisplaythecurrenttimesettingandaprompt
foranewone.PressENTERtokeepthesametime.
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
Tellscmd.exewhethertoverifythatyourfilesarewrittencorrectlytoa
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.
http://www.dostips.com/DosCommandIndex.php
34/39
7/28/2015
DOSCommandIndex
Ifnodateisgiven,copiesonlythosefileswhose
sourcetimeisnewerthanthedestinationtime.
/EXCLUDE:file1[+file2][+file3]...
Specifiesalistoffilescontainingstrings.Eachstring
shouldbeinaseparatelineinthefiles.Whenanyofthe
stringsmatchanypartoftheabsolutepathofthefiletobe
copied,thatfilewillbeexcludedfrombeingcopied.For
example,specifyingastringlike\obj\or.objwillexclude
allfilesunderneaththedirectoryobjorallfileswiththe
.objextensionrespectively.
/PPromptsyoubeforecreatingeachdestinationfile.
/SCopiesdirectoriesandsubdirectoriesexceptemptyones.
/ECopiesdirectoriesandsubdirectories,includingemptyones.
Sameas/S/E.Maybeusedtomodify/T.
/VVerifiesthesizeofeachnewfile.
/WPromptsyoutopressakeybeforecopying.
/CContinuescopyingeveniferrorsoccur.
/IIfdestinationdoesnotexistandcopyingmorethanonefile,
assumesthatdestinationmustbeadirectory.
/QDoesnotdisplayfilenameswhilecopying.
/FDisplaysfullsourceanddestinationfilenameswhilecopying.
/LDisplaysfilesthatwouldbecopied.
/GAllowsthecopyingofencryptedfilestodestinationthatdoes
notsupportencryption.
/HCopieshiddenandsystemfilesalso.
/ROverwritesreadonlyfiles.
/TCreatesdirectorystructure,butdoesnotcopyfiles.Doesnot
includeemptydirectoriesorsubdirectories./T/Eincludes
emptydirectoriesandsubdirectories.
/UCopiesonlyfilesthatalreadyexistindestination.
/KCopiesattributes.NormalXcopywillresetreadonlyattributes.
/NCopiesusingthegeneratedshortnames.
/OCopiesfileownershipandACLinformation.
/XCopiesfileauditsettings(implies/O).
/YSuppressespromptingtoconfirmyouwanttooverwritean
existingdestinationfile.
/YCausespromptingtoconfirmyouwanttooverwritean
existingdestinationfile.
/ZCopiesnetworkedfilesinrestartablemode.
/BCopiestheSymbolicLinkitselfversusthetargetofthelink.
/JCopiesusingunbufferedI/O.Recommendedforverylargefiles.
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/?
http://www.dostips.com/DosCommandIndex.php
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.
http://www.dostips.com/DosCommandIndex.php
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
REM.PreparetheCommandProcessor
SETLOCALENABLEEXTENSIONS
REM
http://www.dostips.com/DosCommandIndex.php
37/39
7/28/2015
DOSCommandIndex
REMCopyrightnote
REMThisscriptisprovidedasis.Nowarantyismade,whatsoever.
REMYoumayuseandmodifythescriptasyoulike,butkeeptheversionhistorywith
REMrecognitiontohttp://www.dostips.cominit.
REM
REMVersionHistory:
REMXX.XXXYYYYMMDDAuthorDescription
SET"version=01.000"&:20051201p.h.initialversion,originhttp://www.dostips.com
SET"version=01.001"&:20060122p.h.Fixmissingexclamationmarksindocumentation(http://www.dostips.com)
SET"version=01.002"&:20060218p.h.replacedTEXTAREAwithPREXMP(http://www.dostips.com)
SET"version=01.003"&:20060218p.h.phpembedding(http://www.dostips.com)
SET"version=01.004"&:20060723p.h.fixpagelinksforFireFox(http://www.dostips.com)
SET"version=01.005"&:20061015p.h.invokeHELPvia'"call"help',allowsoverridinghelpcommandwithahelp.batfile(http://www.dostips.com)
SET"version=01.006"&:20061015p.h.cleanupprogressindicator(http://www.dostips.com)
SET"version=01.007"&:20080316p.h.usecodepage1252tosupporteuropeanusers(http://www.dostips.com)
SET"version=02.000"&:20080316p.h.useFORcommandtogenerateHTML,avoidsmostescapecharacters(http://www.dostips.com)
SET"version=02.000"&:20100201p.h.nowusingcssandxhtml
REM!!Foranewversionentry,copythelastentrydownandmodifyDate,AuthorandDescription
SET"version=%version:=%"
for/f"delims=:tokens=2"%%ain('chcp')doset"restore_codepage=%%a"
chcp1252>NUL
set"z=%~dpn0.htm"
remecho.^<!DOCTYPEHTMLPUBLIC"//W3C//DTDHTML4.0Transitional//EN"^>>"%z%"
echo.^<!DOCTYPEhtmlPUBLIC"//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1transitional.dtd"^>>"%z%"
set"title=DOSCommandIndex"
for/f"tokens=*"%%ain('ver')doset"winver=%%a"
echo.Creatingtheheader...
for%%Ain(
"<htmllang='enUS'xml:lang='enUS'xmlns='http://www.w3.org/1999/xhtml'>"
"<head>"
"<styletype='text/css'>"
"h1{textalign:center;}"
"h2{textalign:center;}"
"table.center{marginleft:auto;marginright:auto;}"
"td{textalign:left;}"
"div.center{textalign:center;}"
"div.sourcebatch{background:#DDDDDD;}"
"div.helptext{background:#F8F8FF;}"
"div.top{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='http://www.dostips.com/'><b>http://www.dostips.com</a><br/>"
"<ahref='http://www.dostips.com/%~n0.php'><b>http://www.dostips.com/%~nx0.php</a>"
"</td></tr>"
"<tr><td>Createdby</td><td>:</td><td><ahref='http://www.dostips.com/%~nx0'>"
"<b>%~nx0</b></a><br/><ahref='#%~n0'><b>SourceCodebelow</b></a></td></tr>"
"</table>"
"</div>"
"<br/><br/>"
"<tableclass='center'>"
)doecho.%%~A>>"%z%"
echo.Creatingtheindex...
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%"
echo.ExtractingHELPtext...
call:initProgresscnt
for/f"tokens=1,*"%%ain('"help|findstr/v/b/c:""/c:"Formore"/c:"SC""')do(
if"%%b"NEQ""(
echo.Processing%%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
)
)
echo.Injectingsourcescript...
http://www.dostips.com/DosCommandIndex.php
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%"
echo.Creatingthefooter...
echo^</xmp^>>>"%z%"
for%%Ain(
"</pre></div>"
""
"</font>"
"</body>"
"</html>"
)doecho.%%~A>>"%z%"
chcp%restore_codepage%>NUL
explorer"%z%"
:SKIP
REM.Endofapplication
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
http://www.dostips.com/DosCommandIndex.php
39/39