Sei sulla pagina 1di 18

DOS Tools

Contents
SometimesDOSistheBestTool ............................ 1
UsingDOSCommands ........................................... 1
CommandLineStatements ............................... 1
Batch(BAT)Files.............................................. 2
Switches ............................................................ 2
Help................................................................... 2
DOSConsoleWindowOperation.......................... 3
ConsoleSystemMenu....................................... 3
ConsoleWindowKeys....................................... 3
HelpfulDOSCommands........................................ 3
DOSFileCommands ............................................... 3
CHKDSK,toCheckDiskDrive.............................. 4
Syntax ............................................................... 4
Examples ........................................................... 4
CD,toChangeCurrentDirectory.......................... 4
Syntax ............................................................... 4
Examples ........................................................... 5
MD,toCreateaDirectory....................................... 5
Syntax ............................................................... 5
Examples ........................................................... 5
RMorRMDIR,toDeleteDirectories..................... 5
Syntax............................................................... 5
XCOPY,toCopyFilesandDirectories ................. 6
Syntax............................................................... 6
Examples........................................................... 7
DIR,toListFiles ...................................................... 8
Syntax............................................................... 8
Examples........................................................... 9
TREE,toDisplayFolderStructure........................ 9
DEL,toDeleteFile(s) .............................................. 9
REN,toRenameFileorDirectory....................... 10
PING,toVerifyNetworkConnection ................ 10
TRACERT,toTracePacketRouteOver
Network............................................................. 11
MEM,toViewMemoryAmount ........................ 12
FORMAT,toClearHardDriveorData
StorageDevice................................................... 12
NETSTAT,toMonitorUseofPorts .................... 13
Example1 ....................................................... 14
Example2 ....................................................... 15
TASKLIST,toListRunningPrograms................ 16
PortUsageAdvicefromGoogle.......................... 18

Sometimes DOS is the Best Tool


SometimesDOScommandsarethebest,andoftenonly,waytodosomething.Considerusingthemforfile
backupsandwhenWindowsExplorerhasindigestion.
Using DOS Commands
DOScommandsmayberunascommandlinestatementsorasbatchfiles.

DOScommandsarecaseinsensitive.

DOScommandsaredocumentedonvariouswebsitesandintheWindowshelpfile(seeCommand
ReferenceMainPage).
Command Line Statements
TorunDOScommands:
1. OpentheDOScommandconsolewindow(akacommandprompt):
(a) UsemenuStart,Run,entercmd.exeOR
(b) UsemenuStart,Programs,CommandPrompt
2. Typeinthecommand.
3. Press[Enter].

TheconsolewindowiswheretheDOScommandinterpretercanberunondemand.Thecommand
interpreterisCMD.EXE(forWindowsNT,2000,andXP)andCOMMAND.COM(forolderversionsand
backwardscompatibility).CMD.EXEisinc:\windows\system32.
Revision: 6/8/2012 Page 1 of 18
Copyright 20042012 Susan Dorey Designs
DOS Tools

Theconsolewindowopensatthedefaultdirectory.ForWindowsXPthisisc:\Documentsand
Settings\Owner.Thecurrentdirectoryisalwaysdisplayedimmediatelytotheleftofthe>character.You
typecommandstotherightofthe>character.Anewpromptappearswhenthecurrentcommandis
completed.
Batch (BAT) Files
Batchfiles,namedx.BAT,arecollectionsofDOScommandsandspecialbatchfilecommands.Thebatchfile
approachmakesiteasytorerunthecommand(s)andalsodocumentsitforfutureuse.

AbatchfileisrunbyopeningitinWindowsExplorer,i.e.,doubleclickingitsname.Whathappensisthat
whenyouopenaBATfile,theDOScommandconsolewindowopens,theBATfilecommandsarerun,
andthewindowisclosed,allofwhichhappensintheblinkofaneye.

Batchfilesaredescribedindetailat
www.computerhope.com/batch.htm
homepages.cambrianc.on.ca/isp1251/lab/BATCH1.html

IvebeenhavingtroublerunningBATfilesbydoubleclickingtheirnames.IcreatedaFileTypeforthem
witheditandopenactions,theformerusingPFEandthelatterusingCMD.EXE.ThenIwasabletoopen
theCMDwindowbutnothinghappened,soItypedthenameoftheBATfileanditran!Well,apparently,
becauseIcannotfindtheresults.AndtheBATfiledisappeared!Itmaybethatyouhavetocreatethe
directoryintowhichyouplaceyourbackupfiles.
Switches
Mostcommandshaveswitcheswhichactsasargumentsorparameters.

? Displaysacompletelistofavailablecommandlineoptionsforsome
DOScommands.
/? Displaysacompletelistofavailablecommandlineoptionsforsome
DOScommands.
/P Pause
|MORE Displayscommandoutputonescreenatatime.Youwillbepromptedto
typeanykeytodisplaythenextscreenoftext.
>filename Redirectsoutputtonamedfile.
>>filename Appendsoutputtonamedfile
>lpt1 Redirectsoutputtoadevice,LPT1inthiscase.
Help
YoucanseehelpfortheDOScommandsbyaparameterafterDOScommand.
Examples:
dirhelp(doesntworkwithchkdsk)
dir/?
Revision: 6/8/2012 Page 2 of 18
Copyright 20042012 Susan Dorey Designs
DOS Tools
DOS Console Window Operation
Console System Menu
Thesystemmenuisaccessedwiththeiconintheupperleftcorner.Youcanchangethewindowsize,font,
andcolors.Youcanalsouseitforediting(ithasactionsforfind,copy,paste,andselectall).

TheSystemmenucanbeopenedinthreeways:(1)leftclicktheicon,(2)rightclickanywhereinthetitlebar,
or(3)withshortcutkeys[Alt+Spacebar].
Console Window Keys
[] retrievespreviouscommand,whichyoucantheneditbeforeusing
[F7] openspopupwindowwithcommandhistory
Helpful DOS Commands
HELP<command> Displayhelpofnamedcommand.Example:helpdir
TITLE Settitleofcommandconsolewindow.Helpfulwithusingmorethanone
windowatatime.
EXIT EndsCommandPromptsessionandclosestheconsolewindow.
DOS File Commands
ThereisacommandlinereferenceAZintheWindowsHelpfile.

ATTRIB Displayandchangefileattributes
CD,CHDIR Changecurrentdirectory
CHKDSK Checkadiskdriveforerrors
CHKNTFS ChecktheharddiskdriverunningNTFSforerrors
COPY Copyoneormorefilestoasecondlocation
DEL,DELETE,ERASE Deleteoneormorefiles
DELTREE Deleteoneormorefilesand/ordirectories;notforWindowsXP
DIR Listthecontentsofoneormoredirectory
DISKCOPY Copythecontentsofonediskandplacethemonanotherdisk
MD,MKDIR Createanewdirectory
MOVE Moveoneormorefilesfromonedirectorytoanotherdirectory
RD,RMDIR Removeoneormoredirectories
REN,RENAME Renameafileordirectory
TREE Viewavisualtreeoftheharddiskdrive
UNDELETE Undeleteafilethathasbeendeleted
XCOPY Copymultiplefiles,directories,and/ordrivesfromonelocationto
another.Usefulforbackups.
Revision: 6/8/2012 Page 3 of 18
Copyright 20042012 Susan Dorey Designs
DOS Tools
CHKDSK, to Check Disk Drive
Checksthecomputersharddiskdrivesforerrors.
Syntax
CHKDSK [ dr i ve: ]
CHKDSK [ dr i ve: ] [ pat h] speci f i es dr i ve and di r ect or y t o check
CHKDSK [ dr i ve: ] [ pat h] f i l ename] speci f i es f i l e( s) t o check f or f r agment at i on

Switches:

/F Fixerrorsonthedisk.
/R Locatebadsectorsandrecoverreadableinformation(WindowsXP).
/V Displaythefullpathandnameofeveryfileonthedisk.
[none] Omitallswitchestocheckthecurrentdisk.
Examples

chkdsk i :
CheckdriveI.
chkdsk i : \ dat a / f
CheckfilesindirectorydataondriveI,fixerrors.
chkdsk
Checkcurrentdisk.

CD, to Change Current Directory


CDdisplaysthenameoforchangesthecurrentdirectory.Ifthespecifieddriveorpathdoesnotexist,there
isnochange.
Syntax
CHDI R [ / D] [ dr i ve: ] [ pat h]
CHDI R [ . . ]
CD [ / D] [ dr i ve: ] [ pat h]
CD [ . . ]
CD\
dr i ve:

Switches:

/D Changecurrentdriveinadditiontochangingcurrentdirectoryfora
drive.
drive: Displaythecurrentdirectoryinthespecifieddrive.
.. Changetotheparentdirectory.
path Changetopath.Dependingontheotherswitches,thiscanbeapathin
thecurrentdirectory,thecurrentdrive,oranewdrive.
none displaythecurrentdriveanddirectory.

IfCommandExtensionsareenabled,CDchangesasfollows:
Revision: 6/8/2012 Page 4 of 18
Copyright 20042012 Susan Dorey Designs
DOS Tools

Thecurrentdirectorystringisconvertedtousethesamecaseastheondisknames.SoCDC:\TEMP
wouldactuallysetthecurrentdirectorytoC:\Tempifthatisthecaseondisk.

CDcommanddoesnottreatspacesasdelimiters,soitispossibletoCDintoasubdirectorynamethat
containsaspacewithoutsurroundingthenamewithquotes.Forexample:

cd \ wi nnt \ pr of i l es\ user name\ pr ogr ams\ st ar t menu

isthesameas:

cd " \ wi nnt \ pr of i l es\ user name\ pr ogr ams\ st ar t menu"

whichiswhatyouwouldhavetotypeifextensionsweredisabled.
Examples
cd\
Movestothehighestlevel,therootofthedrive.
cd . .
Movesbackonedirectory.Forexample,ifyouarewithinthe
C:\WINDOWS\COMMANDdirectory,thismovestoC:\WINDOWS.
cd wi ndows
Movestothewindowssubdirectoryofcurrentdirectory.
cd\ wi ndows
Firstmovesbacktotherootofthedriveandthenintothewindows
directory.
cd wi ndows\ syst em32

Movestothewindows\system32subdirectoryofthecurrentdirectory.
d:
Changestotheddrive.
MD, to Create a Directory
Syntax
MKDI R [ dr i ve: ] pat h
MD [ dr i ve: ] pat h
Examples
md t est
Theaboveexamplecreatesthetestdirectoryinthedirectoryyouarecurrentlyin.

md f : \ dat a
Createthedatadirectoryonthef:drive.
RM or RMDIR, to Delete Directories
Syntax
SwitchesonlyapplytoWindowsXPand2000.Whentheswitchesarenotused,actsonlyonempty
directories.

RMDI R [ / S] [ / Q] [ dr i ve: ] pat h


RD [ / S] [ / Q] [ dr i ve: ] pat h

Revision: 6/8/2012 Page 5 of 18


Copyright 20042012 Susan Dorey Designs
DOS Tools
/S Removesalldirectoriesandfilesinthespecifieddirectoryinadditionto
thedirectoryitself.Usedtoremoveadirectorytree.
/Q Quietmode,donotaskifoktoremoveadirectorytreewith/S.
XCOPY, to Copy Files and Directories
Copiesfilesanddirectorytrees.Canbeusedtocreatebackupmedia.
Syntax
XCOPY sour ce [ dest i nat i on] [ / A | / M] [ / D[ : dat e] ] [ / P] [ / S [ / E] ] [ / W] [ / C] [ / I ]
[ / Q] [ / F] [ / L] [ / H] [ / R] [ / T] [ / U] [ / K] [ / N]

Inthefollowingtablethemostusefulswitchesarehighlighted.

source Specifiesthefile(s)tocopy.Iffileordirectorynamehasembedded
spaces,encloseindoublequotes.
destination Specifiesthelocationand/ornameofnewfiles.Iffileordirectoryname
hasembeddedspaces,encloseindoublequotes.
/A Copiesfileswiththearchiveattributeset,doesntchangetheattribute.
/C Continuescopyingeveniferrorsoccur.
/D:date Copiesfileschangedonorafterthespecifieddate.fnodateisgiven,
copiesonlythosefileswhosesourcetimeisnewerthanthedestination
time.DateisinMMDDYYformat.
/E Copiesdirectoriesandsubdirectories,includingemptyones.Sameas/S
/E.Maybeusedtomodify/T.
/EXCLUDE:filename
[+[file2]][+[file3]]
Excludesdirectoriesandfileswithnamesmatchingstrings(oneormore).
Theargumentisthenameofatextfilewhichcontainsthenamesof
directoriesandfilenamestobeexcluded.Seeexamplesbelow.
NewinWindows2000.
Limitations:
filenamescannothavespaces
directorynamecannothavespaces
iffileisnotlocatedinthesamedirectoryasBATfilethataccessesit,
ordirectoryofcommandprompt,usepath
forfilenames,besttostickto8.3format
longfilenamesshouldbeinquotes,e.g.,longfilename.txt
/F Displaysfullsourceanddestinationfilenameswhilecopying.
/H Copieshiddenandsystemfilesalso.
/I Ifdestinationdoesnotexistandcopyingmorethanonefile,assumesthat
destinationmustbeadirectory.
/K Copiesattributes.Normalxcopywillresetreadonlyattributes.
/L Displaysfilesthatwouldbecopied.
/M Copiesfileswiththearchiveattributeset,turnsoffthearchiveattribute.
/N Copyusingthegeneratedshortnames.
/P Promptsyoubeforecreatingeachdestinationfile.
Revision: 6/8/2012 Page 6 of 18
Copyright 20042012 Susan Dorey Designs
DOS Tools
/Q Doesnotdisplayfilenameswhilecopying.
/R Overwritesreadonlyfiles.
/S Copiesdirectoriesandsubdirectoriesexceptemptyones.
/T Createsdirectorystructure,butdoesnotcopyfiles.Doesnotinclude
emptydirectoriesorsubdirectories./T/Eincludesemptydirectoriesand
subdirectories.
/U Updatesthefilesthatalreadyexistindestination.
/V Verifieseachnewfile.
/W Promptsyoutopressakeybeforecopying.
/Y Overwritesexistingfileswithoutprompting.
NewinWindows2000.
/Y Promptsyoubeforeoverwritingexistingfiles.

Ifthedestinationdoesnotexist,XCOPYwillcreateit.WillacceptUNCpathnames.
Examples
xcopy h: \ *. * / s / k / v
TheabovecommandwillcopyeverythinglocatedontheHdrivetothedriveyouarecurrentlyon.Only
nonemptydirectoriesarecopied.Fileattributesarecopiedintact.Eachfileisverified.

xcopy " c: \ Dat a" " c: \ Backup" / c / i / k / q / s


Iusethisconfiguration.Copyingcontinueseveniferrorsoccur.Assumesthedestinationisadirectoryso
youwillnotbepromptedtosoindicate.Fileattributesarecopiedintact.Filenamesarenotdisplayedas
theyarecopied.Onlynonemptydirectoriesarecopied.

xcopy "c: \ dat a" " f : \ dat a" / d: 10- 01- 01 / s / c / q / k


Theabovecommandwillcopyallfilesanddirectories,evenemptyones,neworchangedsince100101
locatedinthec:\datadirectorytothefdrive,continuecopyingwhenthereareerrors,willnotdisplay
filenames,andwillcopyfileattributes.Donotuse/ewith/d.

Theexclusionfeaturecanbeparticularlyhelpful.
xcopy " c: \ Dat a\ I deas" " c: \ Backup" / c / i / k / q / s / excl ude: backup- excl udes. t xt
xcopy " c: \ Dat a" " c: \ Backup" / excl ude: d: \ mi ne\ backup- excl udes. t xt

Filebackup-excludes.txtcontains:
\ sol st i ce\
. $$$

Thefirstentry,\solstice\,causesthatdirectoryandallfilescontainedwithinittobeexcluded.The
secondentry,.$$$,causesallfilesnamed*.$$$tobeexcluded.Youcanhaveoneormoreentriesinthe
textfile.Theexcludedfilecanbelocatedanywhere,ifnotinthesamedirectoryastheBATfilebeingrun,be
suretoincludeitscompletepath.

Ihavehadtroublewiththe/excludeswitch.Sometimesitworkswithalongfilename,sometimesitdoes
not.Neverunderstoodwhy.
Revision: 6/8/2012 Page 7 of 18
Copyright 20042012 Susan Dorey Designs
DOS Tools
DIR, to List Files
YoucanusetheDIRcommandtocreatealistoffilesinanameddirectoryand,optionally,itssubdirectories;
thelistcanbesavedasatextfileforprintingandlateruse.Thecaptureinatextfileallowsyouto
permanentlyandeasilydocumentfilesinadirectorystructure.
Syntax
DI R [ dr i ve: ] [ pat h] [ f i l ename] [ / P] [ / W] [ / D] [ / A[ [ : ] at t r i but es] ]
[ / O[ [ : ] sor t - or der ] ] [ / T[ [ : ] t i me- f i el d] ] [ / S] [ / B] [ / L] [ / N] [ / X] [ / C]

SwitchesmaybepresetintheDIRCMDenvironmentvariable.Overridepresetswitchesbyprefixingany
switchwith(hyphen)forexample,/W.

SomeswitchesapplytoWindowsNTbutnotWindows98:DTNXC
SomeswitchesapplytoWindows98butnotWindowsNT:V4

[drive:][path][filename] Specifiesdrive,directory,and/orfilestolist.Encloseindoublequotes
whennameshaveembeddedspaces.
/4 Yearsas4digits(ignoredif/Valsoused).
/A Displaysfileswithspecifiedattributes.
Attributevalues:
DDirectoriesRReadonlyfiles
HHiddenfilesAFilesreadyforarchiving
SSystemfilesPrefixmeaningnot
/B Usesbareformat(noheadinginformationorsummary).
/C Displaysthethousandseparatorinfilesizes.Thisisthedefault.Use/C
todisabledisplayofseparator.
/D Listsinwideformatbutfilesarelistsortedbycolumn.
/L Useslowercase,i.e.,changesallnamestolowercase.
/N Newlonglistformatwherefilenamesareonthefarright.
/O Listsbyfilesinsortedorder:.
sortordervalues:
NByname(alphabetic)
SBysize(smallestfirst)
EByextension(alphabetic)
DBydate&time(earliestfirst)
GGroupdirectoriesfirst
Prefixtoreverseorder
/P Pausesaftereachscreenfulofinformation.
/S Displaysfilesinspecifieddirectoryandallsubdirectories.
/T Controlswhichtimefieldisdisplayedorusedforsorting:
timefieldvalues:
CCreation
ALastAccess
WLastWritten
/V Verbosemode.
Revision: 6/8/2012 Page 8 of 18
Copyright 20042012 Susan Dorey Designs
DOS Tools
/W Useswidelistformat.
/X Thisdisplaystheshortnamesgeneratedfornon8dot3filenames.The
formatisthatof/Nwiththeshortnameinsertedbeforethelongname.If
noshortnameispresent,blanksaredisplayedinitsplace.
Examples
Capturecontentsofdirectoryonharddrive,thenprintit:
di r / s / b c: \ dat a\ l ad > c: \ t emp\ di r . t xt
copy c: \ t emp\ di r . t xt l pt 1

Capturecontentsofdirectoryonfileserver:
di r " v: \ knowl edge management " > " c: \ dat a\ di r ect or y l i st s\ KMI Li br ar y Di r . t xt "

Capturecontentsofadirectoryandallsubdirectories,usefullfilenames,groupsubdirectoriesatthe
beginningofthelist,andsortfilesbyname.
di r / B / S / O: G / O: N / T: W" c: \ dat a\ pge 2001\ manual " > " c: \ dat a\ pge
2001\ manual \ di r . t xt "

Capturecontentsofdirectoryonwebsite:
di r " \ \ i know- sps. schwab. com\ si t es\ i s_at _f ms\ The Back Room" / o: n > " h: \ web back
di r ect or y l i st 120506. t xt "

[Inthisexample,thedirectoryisadocumentlibraryonaSharePointsite.]
TREE, to Display Folder Structure
Graphicallydisplaysthefolderstructureofadriveorpath.

TREE [ dr i ve: ] [ pat h] [ / F] [ / A]

/ F
Displaythenamesofthefilesineachfolder.
/ A
UseASCIIinsteadofextendedcharacters.
DEL, to Delete File(s)
Deletesoneormorefilesincurrentdirectory.

DEL [ / P] [ / F] [ / S] [ / Q] [ / A[ [ : ] at t r i but es] ] names


ERASE [ / P] [ / F] [ / S] [ / Q] [ / A[ [ : ] at t r i but es] ] names

namesSpecifiesalistofoneormorefilesordirectories.
Wildcardsmaybeusedtodeletemultiplefiles,e.g.,
DELc:\data\*.*willdeleteallthefileswithinthenameddirectory
DELc:\data\*.wpdwilldeleteallthefileswiththesuffixwpdwithinthenameddirectory
Ifadirectoryisspecified,allfileswithinthedirectorywillbedeleted,e.g.,DELc:\data

/P promptsforconfirmationbeforedeletingeachfile.
/F forcedeletingofreadonlyfiles.
/S deletespecifiedfilesfromallsubdirectories.
Revision: 6/8/2012 Page 9 of 18
Copyright 20042012 Susan Dorey Designs
DOS Tools
/Q Quietmode,donotaskifoktodeleteonglobalwildcard
/A selectsfilestodeletebasedonattributes:
RReadonlyfilesSSystemfiles
HHiddenfilesAFilesreadyforarchiving
Prefixmeaningnot

IfCommandExtensionsareenabledDELandERASEchangeasfollows:Thedisplaysemanticsofthe/S
switcharereversedinthatitshowsyouonlythefilesthataredeleted,nottheonesitcouldnotfind.
REN, to Rename File or Directory
SometimesWindowsExplorerwillnotletyourenameadirectory.Ithasitsexcuses.Makesurethedirectory
isnotinuse,thenusethisDOScommand.Itrenamesfilesordirectoryintheircurrentlocation.

RENAME [ dr i ve: ] [ pat h] [ di r ect or yname1 | f i l ename1] [ di r ect or yname2 | f i l ename2]


REN [ dr i ve: ] [ pat h] [ di r ect or yname1 | f i l ename1] [ di r ect or yname2 | f i l ename2]

Notethatyoucannotspecifyanewdriveorpathforyourdestinationthatwouldbemovingthe
file/directory.

Examples:
renamec:\datamine Renamethedirectorydatatomine
rename*.txt*.bak Renamealltextfilestofileswith.bakextension
PING, to Verify Network Connection
Verifiesconnectiontooneormoreremotecomputers.AvailableonlyifTCP/IPisinstalled.

PI NG dest i nat i on ( as URI or I P addr ess)

Example:
PINGen.wikipedia.org
PING208.80.152.10

PINGsendsasmallpacketthroughthenetworktoaparticularaddress.Thereceivingaddressreturnsa
packetwiththeIPaddressofthereceiver.Ifthereisnoreturnpacket,thedestinationaddressiseithernon
existentorhasnonetworkconnection.Ifthereisareturnpacket,PINGdeterminesthenumberofhops
alongthepathandtheelapsedtime.

Thereareoptionalswitches:

PI NG [ - t ] [ - a] [ - n count ] [ - l si ze] [ - f ] [ - i TTL] [ - v TOS] [ - r count ] [ - s


count ] [ [ - j host - l i st ] | [ - k host - l i st ] ] [ - w t i meout ] dest i nat i on- l i st

t Pingthespecifiedhostuntilinterrupted.
a Resolveaddressestohostnames.
ncount Numberofechorequeststosend.
lsize Sendbuffersize.
f SetDontFragmentflaginpacket.
iTTL TimeToLive.
Revision: 6/8/2012 Page 10 of 18
Copyright 20042012 Susan Dorey Designs
DOS Tools
vTOS TypeOfService.
rcount Recordrouteforcounthops.
scount Timestampforcounthops.
jhostlist Loosesourceroutealonghostlist.
khostlist Strictsourceroutealonghostlist.
wtimeout Timeoutinmillisecondstowaitforeachreply.

InWindows2000youcanpress[CtrlBreak]whenrunningthetoptionforalistofstatistics.Press[Ctrl+C]
toactuallystoptheping.

Exampleofreturnmessages:

C: \ Document s and Set t i ngs\ Owner >pi ng www. susandor eydesi gns. com

Pi ngi ng susandor eydesi gns. com[ 66. 226. 64. 26] wi t h 32 byt es of dat a:

Repl y f r om66. 226. 64. 26: byt es=32 t i me=23ms TTL=55
Repl y f r om66. 226. 64. 26: byt es=32 t i me=23ms TTL=55
Repl y f r om66. 226. 64. 26: byt es=32 t i me=22ms TTL=55
Repl y f r om66. 226. 64. 26: byt es=32 t i me=22ms TTL=55

Pi ng st at i st i cs f or 66. 226. 64. 26:
Packet s: Sent = 4, Recei ved = 4, Lost = 0 ( 0%l oss) ,
Appr oxi mat e r ound t r i p t i mes i n mi l l i - seconds:
Mi ni mum= 22ms, Maxi mum= 23ms, Aver age = 22ms
TRACERT, to Trace Packet Route Over Network
AkaTRACEROUTE,thisTCP/IPutilityallowsyoutodeterminetheroutepacketstakethroughanetwork
toreachaparticularhostthatyouspecify.Ifusedproperly,TRACERTcanhelpyoufindpointsinyour
networkthatareeitherroutedincorrectlyorarenotexistentatall.

Syntax:
TRACERT [ - d] [ - h maxi mum_hops] [ - j host - l i st ] [ - w t i meout ] t ar get _name

Switches:

d Donotresolveaddressestohostnames.
hmaximum_hops Maximumnumberofhopstosearchfortarget.
jhostlist Loosesourceroutealonghostlist.
wtimeout Waittimeoutmillisecondsforeachreply.

Exampleofresults:

C: \ Document s and Set t i ngs\ Owner >t r acer t 66. 226. 64. 26

Tr aci ng r out e t o pr o25. abac. com[ 66. 226. 64. 26]
over a maxi mumof 30 hops:

1 <1 ms <1 ms <1 ms 192. 168. 1. 1
2 8 ms 9 ms 8 ms adsl - 70- 137- 159- 254. dsl . snf c21. sbcgl obal . net
[ 70
. 137. 159. 254]
3 9 ms 9 ms 8 ms di st 1- vl an52. snf cca. sbcgl obal . net [ 206. 13. 3. 65]
Revision: 6/8/2012 Page 11 of 18
Copyright 20042012 Susan Dorey Designs
DOS Tools

4 9 ms 8 ms 8 ms bb1- 10g2- 0. snf cca. sbcgl obal . net
[ 216. 102. 176. 224
]
5 10 ms 9 ms 9 ms 151. 164. 95. 198
6 10 ms 9 ms 10 ms asn2828- XO. pxpaca. sbcgl obal . net
[ 151. 164. 249. 102
]
7 10 ms 10 ms 10 ms t e- 3- 2- 0. r ar 3. sanj ose- ca. us. xo. net
[ 207. 88. 14. 97
]
8 19 ms 18 ms 24 ms 207. 88. 14. 98. pt r . us. xo. net [ 207. 88. 14. 98]
9 22 ms 22 ms 22 ms 207. 88. 186. 54. pt r . us. xo. net [ 207. 88. 186. 54]
10 25 ms 24 ms 25 ms gi 1- 2. cr 1. sandi ego. abac. net [ 66. 226. 66. 5]
11 23 ms 22 ms 23 ms pr o25. abac. com[ 66. 226. 64. 26]

Tr ace compl et e.
MEM, to View Memory Amount
Displaystheamountofusedandfreememoryinyourcomputer.

Exampleofresult:

C: \ DOCUME~1\ Owner >mem




655360 byt es t ot al convent i onal memor y
655360 byt es avai l abl e t o MS- DOS
633168 l ar gest execut abl e pr ogr amsi ze

1048576 byt es t ot al cont i guous ext ended memor y
0 byt es avai l abl e cont i guous ext ended memor y
941056 byt es avai l abl e XMS memor y
MS- DOS r esi dent i n Hi gh Memor y Ar ea
FORMAT, to Clear Hard Drive or Data Storage Device
FORMATisusedtoerasealloftheinformationoffofacomputerdisketteorfixeddrivetherebypreparingit
forneworfreshuse.CDscanbepurchasedpreformatted.

FORMAT dr i ve: [ / FS: f i l e- syst em] [ / V: l abel ] [ / Q] [ si ze] [ / C]

/FS:filesystem Thefilesystem:(FATorNTFS.
TheNTFSfilesystemdoesnotfunctiononfloppydisks.
/V:label Thevolumelabel.
/Q Quickformat.
/C Compressionfilesaddedtothenewdiskwillbecompressed.
size Maybedefinedeitherwith/F:sizeor/A:size.
Defaultsettings(via/F)arestronglyrecommendedforgeneraluse.
NTFSsupports512,1024,2048,4096,8192,16K,32K,64K.
FATsupports8192,16K,32K,64K,128K,256K.
NTFScompressionisnotsupportedforallocationunitsabove4096.
/A:size Allocationunitsize.
/F:size sizeisthesizeofthefloppydisk(720,1.2,1.44,2.88,or20.8).
Revision: 6/8/2012 Page 12 of 18
Copyright 20042012 Susan Dorey Designs
DOS Tools
Lookingfortechniquestomonitoruseofports.
NETSTAT, to Monitor Use of Ports

C: \ Document s and Set t i ngs\ sdor ey>net st at / ? >c: \ dat a\ net st at e. t xt

DisplaysprotocolstatisticsandcurrentTCP/IPnetworkconnections.

NETSTAT [ - a] [ - b] [ - e] [ - n] [ - o] [ - p pr ot o] [ - r ] [ - s] [ - v] [ i nt er val ]

aDisplaysallconnectionsandlisteningports.
bDisplaystheexecutableinvolvedincreatingeachconnectionor
listeningport.Insomecaseswellknownexecutableshost
multipleindependentcomponents,andinthesecasesthe
sequenceofcomponentsinvolvedincreatingtheconnection
orlisteningportisdisplayed.Inthiscasetheexecutable
nameisin[]atthebottom,ontopisthecomponentitcalled,
andsoforthuntilTCP/IPwasreached.Notethatthisoption
canbetimeconsumingandwillfailunlessyouhavesufficient
permissions.
eDisplaysEthernetstatistics.Thismaybecombinedwiththes
option.
nDisplaysaddressesandportnumbersinnumericalform.
oDisplaystheowningprocessIDassociatedwitheachconnection.
pprotoShowsconnectionsfortheprotocolspecifiedbyproto;proto
maybeanyof:TCP,UDP,TCPv6,orUDPv6.Ifusedwiththes
optiontodisplayperprotocolstatistics,protomaybeanyof:
IP,IPv6,ICMP,ICMPv6,TCP,TCPv6,UDP,orUDPv6.
rDisplaystheroutingtable.
sDisplaysperprotocolstatistics.Bydefault,statisticsare
shownforIP,IPv6,ICMP,ICMPv6,TCP,TCPv6,UDP,andUDPv6;
thepoptionmaybeusedtospecifyasubsetofthedefault.
vWhenusedinconjunctionwithb,willdisplaysequenceof
componentsinvolvedincreatingtheconnectionorlistening
portforallexecutables.
intervalRedisplaysselectedstatistics,pausingintervalseconds
betweeneachdisplay.PressCTRL+Ctostopredisplaying
statistics.Ifomitted,netstatwillprintthecurrent
configurationinformationonce.

ToviewTCP/UDPportswhichareinusebyagivenprocesswerecommendthefreewareutilityActive
PortsfromSmartLineInc..ThisutilityprovidesarealtimeGUIviewofwhichportsareinusebywhich
processeswhichcanbehandyfortroubleshootingissueslikeportconflictsbetweennetworkenabled
applications.Seehttp://www.devicelock.com/freeware.html.

http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbersisagoodreferenceofthedomainof
portnumbers.
Revision: 6/8/2012 Page 13 of 18
Copyright 20042012 Susan Dorey Designs
DOS Tools
Example 1
Ifyouareonlyinterestedinseeingwhichportsarecurrentlyopen,runningnetstat -afromthecommand
linewilllistthestatusofallportsinuse.Itwillnot,however,tellyouwhichprocessisaccessingthoseports.

Mi cr osof t Wi ndows XP [ Ver si on 5. 1. 2600]


( C) Copyr i ght 1985- 2001 Mi cr osof t Cor p.

C: \ Document s and Set t i ngs\ sdor ey>net st at - a

Act i ve Connect i ons

Pr ot o Local Addr ess For ei gn Addr ess St at e
TCP 1USL14928: epmap 1USL14928. NOE. Noki a. com: 0 LI STENI NG
TCP 1USL14928: mi cr osof t - ds 1USL14928. NOE. Noki a. com: 0 LI STENI NG
TCP 1USL14928: 2967 1USL14928. NOE. Noki a. com: 0 LI STENI NG
TCP 1USL14928: 9495 1USL14928. NOE. Noki a. com: 0 LI STENI NG
TCP 1USL14928: net bi os- ssn 1USL14928. NOE. Noki a. com: 0 LI STENI NG
TCP 1USL14928: 1025 l ocal host : 1026 ESTABLI SHED
TCP 1USL14928: 1026 l ocal host : 1025 ESTABLI SHED
TCP 1USL14928: 1027 l ocal host : 1028 ESTABLI SHED
TCP 1USL14928: 1028 l ocal host : 1027 ESTABLI SHED
TCP 1USL14928: 1032 l ocal host : 1033 ESTABLI SHED
TCP 1USL14928: 1033 l ocal host : 1032 ESTABLI SHED
TCP 1USL14928: 1034 l ocal host : 1035 ESTABLI SHED
TCP 1USL14928: 1035 l ocal host : 1034 ESTABLI SHED
TCP 1USL14928: 1248 l ocal host : 5550 ESTABLI SHED
TCP 1USL14928: 1249 l ocal host : 1250 ESTABLI SHED
TCP 1USL14928: 1250 l ocal host : 1249 ESTABLI SHED
TCP 1USL14928: 1251 l ocal host : 1252 ESTABLI SHED
TCP 1USL14928: 1252 l ocal host : 1251 ESTABLI SHED
TCP 1USL14928: 5550 1USL14928. NOE. Noki a. com: 0 LI STENI NG
TCP 1USL14928: 5550 l ocal host : 1248 ESTABLI SHED
TCP 1USL14928: 9000 1USL14928. NOE. Noki a. com: 0 LI STENI NG
TCP 1USL14928: 11165 1USL14928. NOE. Noki a. com: 0 LI STENI NG
TCP 1USL14928: 49100 1USL14928. NOE. Noki a. com: 0 LI STENI NG
TCP 1USL14928: net bi os- ssn 1USL14928. NOE. Noki a. com: 0 LI STENI NG
TCP 1USL14928: 1313 dawdc102. amer i cas. noki a. com: mi cr osof t - ds
ESTABL
I SHED
TCP 1USL14928: 1463 65. 54. 30. 138: 1025 ESTABLI SHED
TCP 1USL14928: 1470 65. 54. 30. 11: 1330 ESTABLI SHED
TCP 1USL14928: 1778 65. 54. 30. 67: 4021 ESTABLI SHED
TCP 1USL14928: 2718 dawdc101. amer i cas. noki a. com: mi cr osof t - ds
TI ME_W
AI T
TCP 1USL14928: 2736 dawdc101. amer i cas. noki a. com: mi cr osof t - ds
TI ME_W
AI T
TCP 1USL14928: 2753 dawdc101. amer i cas. noki a. com: mi cr osof t - ds
TI ME_W
AI T
TCP 1USL14928: 2771 dawdc101. amer i cas. noki a. com: mi cr osof t - ds
TI ME_W
AI T
TCP 1USL14928: 2790 dawdc101. amer i cas. noki a. com: mi cr osof t - ds
ESTABL
I SHED
UDP 1USL14928: 259 *: *
UDP 1USL14928: mi cr osof t - ds *: *
UDP 1USL14928: i sakmp *: *
UDP 1USL14928: 1029 *: *
UDP 1USL14928: 1030 *: *
Revision: 6/8/2012 Page 14 of 18
Copyright 20042012 Susan Dorey Designs
DOS Tools
UDP 1USL14928: 1031 *: *
UDP 1USL14928: 1464 *: *
UDP 1USL14928: 2786 *: *
UDP 1USL14928: 4500 *: *
UDP 1USL14928: 18234 *: *
UDP 1USL14928: nt p *: *
UDP 1USL14928: net bi os- ns *: *
UDP 1USL14928: net bi os- dgm *: *
UDP 1USL14928: 1900 *: *
UDP 1USL14928: nt p *: *
UDP 1USL14928: 1043 *: *
UDP 1USL14928: 1079 *: *
UDP 1USL14928: 1086 *: *
UDP 1USL14928: 1097 *: *
UDP 1USL14928: 1580 *: *
UDP 1USL14928: 1900 *: *
UDP 1USL14928: 2523 *: *
UDP 1USL14928: nt p *: *
UDP 1USL14928: net bi os- ns *: *
UDP 1USL14928: net bi os- dgm *: *
UDP 1USL14928: 1900 *: *

C: \ Document s and Set t i ngs\ sdor ey>
Example 2
C: \ Document s and Set t i ngs\ sdor ey>net st at - an

Act i ve Connect i ons

Pr ot o Local Addr ess For ei gn Addr ess St at e
TCP 0. 0. 0. 0: 135 0. 0. 0. 0: 0 LI STENI NG
TCP 0. 0. 0. 0: 445 0. 0. 0. 0: 0 LI STENI NG
TCP 0. 0. 0. 0: 2967 0. 0. 0. 0: 0 LI STENI NG
TCP 0. 0. 0. 0: 9495 0. 0. 0. 0: 0 LI STENI NG
TCP 10. 186. 150. 13: 139 0. 0. 0. 0: 0 LI STENI NG
TCP 127. 0. 0. 1: 1025 127. 0. 0. 1: 1026 ESTABLI SHED
TCP 127. 0. 0. 1: 1026 127. 0. 0. 1: 1025 ESTABLI SHED
TCP 127. 0. 0. 1: 1027 127. 0. 0. 1: 1028 ESTABLI SHED
TCP 127. 0. 0. 1: 1028 127. 0. 0. 1: 1027 ESTABLI SHED
TCP 127. 0. 0. 1: 1032 127. 0. 0. 1: 1033 ESTABLI SHED
TCP 127. 0. 0. 1: 1033 127. 0. 0. 1: 1032 ESTABLI SHED
TCP 127. 0. 0. 1: 1034 127. 0. 0. 1: 1035 ESTABLI SHED
TCP 127. 0. 0. 1: 1035 127. 0. 0. 1: 1034 ESTABLI SHED
TCP 127. 0. 0. 1: 1248 127. 0. 0. 1: 5550 ESTABLI SHED
TCP 127. 0. 0. 1: 1249 127. 0. 0. 1: 1250 ESTABLI SHED
TCP 127. 0. 0. 1: 1250 127. 0. 0. 1: 1249 ESTABLI SHED
TCP 127. 0. 0. 1: 1251 127. 0. 0. 1: 1252 ESTABLI SHED
TCP 127. 0. 0. 1: 1252 127. 0. 0. 1: 1251 ESTABLI SHED
TCP 127. 0. 0. 1: 5550 0. 0. 0. 0: 0 LI STENI NG
TCP 127. 0. 0. 1: 5550 127. 0. 0. 1: 1248 ESTABLI SHED
TCP 127. 0. 0. 1: 9000 0. 0. 0. 0: 0 LI STENI NG
TCP 127. 0. 0. 1: 11165 0. 0. 0. 0: 0 LI STENI NG
TCP 127. 0. 0. 1: 49100 0. 0. 0. 0: 0 LI STENI NG
TCP 172. 18. 87. 163: 139 0. 0. 0. 0: 0 LI STENI NG
TCP 172. 18. 87. 163: 1463 65. 54. 30. 138: 1025 ESTABLI SHED
Revision: 6/8/2012 Page 15 of 18
Copyright 20042012 Susan Dorey Designs
DOS Tools
TCP 172. 18. 87. 163: 1470 65. 54. 30. 11: 1330 ESTABLI SHED
TCP 172. 18. 87. 163: 1778 65. 54. 30. 67: 4021 ESTABLI SHED
TCP 172. 18. 87. 163: 2822 10. 241. 36. 15: 445 ESTABLI SHED
TCP 172. 18. 87. 163: 3247 10. 241. 36. 20: 445 TI ME_WAI T
TCP 172. 18. 87. 163: 3266 10. 241. 36. 20: 445 TI ME_WAI T
TCP 172. 18. 87. 163: 3285 10. 241. 36. 20: 445 TI ME_WAI T
TCP 172. 18. 87. 163: 3302 10. 241. 32. 28: 8080 ESTABLI SHED
TCP 172. 18. 87. 163: 3308 10. 241. 36. 20: 445 TI ME_WAI T
TCP 172. 18. 87. 163: 3326 10. 241. 32. 28: 8080 ESTABLI SHED
UDP 0. 0. 0. 0: 259 *: *
UDP 0. 0. 0. 0: 445 *: *
UDP 0. 0. 0. 0: 500 *: *
UDP 0. 0. 0. 0: 1029 *: *
UDP 0. 0. 0. 0: 1030 *: *
UDP 0. 0. 0. 0: 1031 *: *
UDP 0. 0. 0. 0: 1464 *: *
UDP 0. 0. 0. 0: 3328 *: *
UDP 0. 0. 0. 0: 4500 *: *
UDP 0. 0. 0. 0: 18234 *: *
UDP 10. 186. 150. 13: 123 *: *
UDP 10. 186. 150. 13: 137 *: *
UDP 10. 186. 150. 13: 138 *: *
UDP 10. 186. 150. 13: 1900 *: *
UDP 127. 0. 0. 1: 123 *: *
UDP 127. 0. 0. 1: 1043 *: *
UDP 127. 0. 0. 1: 1079 *: *
UDP 127. 0. 0. 1: 1086 *: *
UDP 127. 0. 0. 1: 1097 *: *
UDP 127. 0. 0. 1: 1580 *: *
UDP 127. 0. 0. 1: 1900 *: *
UDP 127. 0. 0. 1: 2523 *: *
UDP 172. 18. 87. 163: 123 *: *
UDP 172. 18. 87. 163: 137 *: *
UDP 172. 18. 87. 163: 138 *: *
UDP 172. 18. 87. 163: 1900 *: *

C: \ Document s and Set t i ngs\ sdor ey>
TASKLIST, to List Running Programs
TASKLI ST [ / S syst em[ / U user name [ / P [ passwor d] ] ] ]
[ / M [ modul e] | / SVC | / V] [ / FI f i l t er ] [ / FO f or mat ] [ / NH]

Description:Thiscommandlinetooldisplaysalistofapplication(s)andassociatedtask(s)/process(es)
currentlyrunningoneitheralocalorremotesystem.

ParameterList:
/SsystemSpecifiestheremotesystemtoconnectto.

Revision: 6/8/2012 Page 16 of 18


Copyright 20042012 Susan Dorey Designs
DOS Tools
/U[domain\]userSpecifiestheusercontextunderwhich
thecommandshouldexecute.

/P[password]Specifiesthepasswordforthegiven
usercontext.Promptsforinputifomitted.

/M[module]ListsalltasksthathaveDLLmodulesloaded
inthemthatmatchthegivenpatternname.
Ifthemodulenameisnotspecified,
displaysallmodulesloadedbyeachtask.

/SVCDisplaysservicesineachprocess.

/VSpecifiesthattheverboseinformation
istobedisplayed.

/FIfilterDisplaysasetoftasksthatmatcha
givencriteriaspecifiedbythefilter.

/FOformatSpecifiestheoutputformat.
Validvalues:TABLE,LIST,CSV.

/NHSpecifiesthattheColumnHeadershould
notbedisplayedintheoutput.
ValidonlyforTABLEandCSVformats.

/?Displaysthishelp/usage.

Filters:
Fi l t er Name Val i d Oper at or s Val i d Val ue( s)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
STATUS eq, ne RUNNI NG | NOT RESPONDI NG
I MAGENAME eq, ne I mage name
PI D eq, ne, gt , l t , ge, l e PI D val ue
SESSI ON eq, ne, gt , l t , ge, l e Sessi on number
SESSI ONNAME eq, ne Sessi on name
CPUTI ME eq, ne, gt , l t , ge, l e CPU t i me i n t he f or mat
of hh: mm: ss.
hh - hour s,
mm- mi nut es, ss - seconds
MEMUSAGE eq, ne, gt , l t , ge, l e Memor y usage i n KB
USERNAME eq, ne User name i n [ domai n\ ] user
f or mat
SERVI CES eq, ne Ser vi ce name
WI NDOWTI TLE eq, ne Wi ndow t i t l e
MODULES eq, ne DLL name

Examples:
TASKLI ST
TASKLI ST / M
Revision: 6/8/2012 Page 17 of 18
Copyright 20042012 Susan Dorey Designs
DOS Tools
TASKLI ST / V
TASKLI ST / SVC
TASKLI ST / M wbem*
TASKLI ST / S syst em/ FO LI ST
TASKLI ST / S syst em/ U domai n\ user name / FO CSV / NH
TASKLI ST / S syst em/ U user name / P passwor d / FO TABLE / NH
TASKLI ST / FI " USERNAME ne NT AUTHORI TY\ SYSTEM" / FI " STATUS eq r unni ng"

C: \ Document s and Set t i ngs\ sdor ey>
Port Usage Advice from Google
Hereisaquickandeasywaytodigintowhatportsarebeingused,andwhatappsareusingthem.

Step1:Findoutwhatportsarebeingused:
C: \ >Net St at o

Whichwillreturnthefollowing(yourlistwillprobablybemuchlonger):
Pr ot o Local Addr ess For ei gn Addr ess St at e PI D
TCP EC968728: 1108 somesi t e. cor p. com: ht t ps ESTABLI SHED 4072

Step2:Seewhichapp(&more)isusingthatport:
C: \ >TaskLi st / FI " PI D eq 4072" / FO LI ST / V

Whichwillreturnthefollowing

I mage Name: OUTLOOK. EXE


PI D: 4072
Sessi on Name: Consol e
Sessi on#: 0
MemUsage: 105, 320 K
St at us: Runni ng
User Name: ****Domai nName****\ bgr ot h
CPU Ti me: 0: 01: 44
Wi ndow Ti t l e: I nbox - Mi cr osof t Out l ook

Revision: 6/8/2012 Page 18 of 18


Copyright 20042012 Susan Dorey Designs

Potrebbero piacerti anche