CTEC1863 MS-DOSCrashCourse Page1of3
MS-DOSCRASHCOURSE
(Adapted from "Windows Annoyances" by David A. Karp, O'Reilly & Associates,1997.)
AtleastonelabinthiscourserequiresthatyoutypecommandsintoaDOSwindow.Ifyoudon'tquitehaveagrasponthisconcept,here'sacrashcourseonMS-DOS(shortforMicrosoftDiskOperatingSystem).DOShasbeenincludedwithPCssincetheoriginalIBM5150PCintheearly1980s,andeventhenewestPCsstilluseittosomeextent.DOSwasthePCoperatingsystemusedbeforeMicrosoftWindowsbecamethestandardandstillhassomeusetoday.AllversionsofMicrosoftWindowsfrom1.0to3.11reliedonDOS.Windowswasthoughtofonlyasanextension,asoneneededtoloadDOSbeforestartingWindows.Windows95,98andMEwerestillbasedsomewhatonMS-DOSforcompatibilitywiththevastmajorityofavailablesoftwareandMicrosofthasmadeWindowsNT,2000,XP,2003,2008,2012,2016,Vista,7,8,8.1and10completelyindependentofMS-DOS,butstillmakesavailablethecommandpromptforthosewhoneedthefunctionality.
RatherthanunloadingWindowstoaccessthecommandprompt,yousimplyloadanothercommandpromptwhileremaininginWindows.Thisisoftenreferredtoasa“DOSbox”or“DOSwindow.”Ifyoudon'thaveaCommandPromptiteminyourStartMenu,youcanusetheStartMenu'sRuncommandorsearchboxtoexecutecmd.exe(orcommand.comonolderversionsofWindows).
You'llseeawindowthatlooksliketheoneshownbelowinFig.3.Thecursorindicatesthecommandline(wherecommandsaretyped),andthepromptusuallyshowsthecurrentworkingdirectory(here,C:\Users\campus).
TorunprogramsinaDOSbox,typethenameoftheprogramatthecommandline(alsocalledtheCpromptbecauseitusuallylookslikeC:\>)andpressEnter.YoushouldknowthefollowingbasicDOScommands.Thecommandsandtheparameters(theinformationyousupplytothecommand)canbeineitheruppercaseorlowercase(orboth.)Ifthereismorethanoneparameter,eachisseparatedbyaspace.
Figure2.Windows7StartMenu
Figure1.Type"cmd"inWindows7searchbox.
CTEC1863 MS-DOSCrashCourse Page2of3
Figure3.TypicalWindows7CommandPromptWindow
CD foldername Changestheworkingdirectorytofoldername.IfthepromptindicatesthatyouareinC:\Windows,andyouwanttorunaDOSprogramlocatedinC:\Files,typeCD C:\FILES.TypingCDbyitselfwilltellyouthecurrentworkingdirectory,i.e.,whereyouareatthemoment,althoughthepromptshowsthatalready.UseCD /D drive:\foldername toalsochangethecurrentdrive.
DIR Displaysalistingofallthefilesanddirectoriesinthecurrentworkingdirectory.UseCDtochangetoadifferentdirectory.TypeDIR C:\FILEStodisplaythecontentsofC:\FileswithoutusingtheCDcommand.TypeDIR /?foradditionaloptions.
ATTRIB filename Changestheattributes(alsocalledproperties)ofafile.InExplorer,youcanright-clickonafileorgroupoffilestochangetheattributes(Rforreadonly,Sforsystem,Aforarchive,andHforhidden).ATTRIBistheDOScounterparttothisfunctionality.Inaddition,ATTRIBletsyouchangetheSattribute--somethingExplorerdoesn'tletyoudo.Herearesomeexamples:
o ATTRIB +H MYFILE.TXT--Thisturnsonthe"H"parameterforthefilemyfile.txt.o ATTRIB -R "ANOTHER FILE.DOC"--Thisturnsoffthe"R"parameterforthefileanother
file.doc(notethequotesusedbecauseofthespaceinthefilename).o TypeATTRIB /?foradditionaloptions.
COPY filename destination Copiesafiletoanotherdirectoryordrive,specifiedasdestination.ThisisthesameasdragginganddroppingfilesinExplorer,exceptthatthekeyboardisusedinsteadofthemouse.Forexample,tocopythefilemyfile.txt(locatedinthecurrentworkingdirectory)toyourUSBflashdrive,typeCOPY MYFILE.TXT E:\.
XCOPY source destination Copiesafileorawholedirectorytoanotherdirectoryordrive,specifiedasdestination.ThisisthesameasdragginganddroppingfoldersinExplorer.XCOPYismuchmoreflexibleandpowerfulthanCOPY.Forexample,tocopythedirectoryfilesandallitssubdirectories(evenemptyones)toyournetworkdrive,typeXCOPY FILES W:\FilesBackup /E /I.TypeXCOPY /?foradditionaloptions.
CTEC1863 MS-DOSCrashCourse Page3of3
MOVE filename destination ThesameasCOPY,exceptthatthefileismovedinsteadofcopied.
REN oldfilename newfilename Renamesafiletonewfilename.Thisisespeciallyuseful,asyoucanusetheRENcommandtorenamemorethatonefileatonce--somethingExplorerdoesn'tletyoudo.Forexample,torenamemyfile.txttoherfile.txt,typeREN MyFile.txt HerFile.txt.Tochangetheextensionsofallthefilesinthecurrentworkingdirectoryfrom.TXTto.DOC,typeREN *.TXT *.DOC.
DEL filename Deletesafile.Forexample,todeletethefilemyfile.txt,typeDEL MYFILE.TXT.Thisisnotthesameasdeletingafile(withthemouse)inWindows,asthefilewillnotbestoredintheRecycleBin.TheWindowsequivalentistoholddowntheShiftkeywhiledeletingafilewiththemouse.
EXIT
Closesthecommandpromptwindow.Inmostsituations,youcanjustclicktheclosebutton attheupperrightcornerofthewindow,buttheEXITcommandissafer,becauseitmeansthatnootherDOScommandiscurrentlyrunning.
Figure4.Windows10DesktopandCommandPromptWindow.
Top Related