MSDOS Crash Course - Technology at Niagara College...

3
CTEC1863 MS-DOS Crash Course Page 1 of 3 MS-DOS CRASH COURSE (Adapted from "Windows Annoyances" by David A. Karp, O'Reilly & Associates, 1997.) At least one lab in this course requires that you type commands into a DOS window. If you don't quite have a grasp on this concept, here's a crash course on MS-DOS (short for Microsoft Disk Operating System). DOS has been included with PCs since the original IBM 5150 PC in the early 1980s, and even the newest PCs still use it to some extent. DOS was the PC operating system used before Microsoft Windows became the standard and still has some use today. All versions of Microsoft Windows from 1.0 to 3.11 relied on DOS. Windows was thought of only as an extension, as one needed to load DOS before starting Windows. Windows 95, 98 and ME were still based somewhat on MS-DOS for compatibility with the vast majority of available software and Microsoft has made Windows NT, 2000, XP, 2003, 2008, 2012, 2016, Vista, 7, 8, 8.1 and 10 completely independent of MS-DOS, but still makes available the command prompt for those who need the functionality. Rather than unloading Windows to access the command prompt, you simply load another command prompt while remaining in Windows. This is often referred to as a “DOS box” or “DOS window.” If you don't have a Command Prompt item in your Start Menu, you can use the Start Menu's Run command or search box to execute cmd.exe (or command.com on older versions of Windows). You'll see a window that looks like the one shown below in Fig. 3. The cursor indicates the command line (where commands are typed), and the prompt usually shows the current working directory (here, C:\Users\campus). To run programs in a DOS box, type the name of the program at the command line (also called the C prompt because it usually looks like C:\>) and press Enter. You should know the following basic DOS commands. The commands and the parameters (the information you supply to the command) can be in either uppercase or lowercase (or both.) If there is more than one parameter, each is separated by a space. Figure 2. Windows 7 Start Menu Figure 1. Type "cmd" in Windows 7 search box.

Transcript of MSDOS Crash Course - Technology at Niagara College...

Page 1: MSDOS Crash Course - Technology at Niagara College …technology.niagarac.on.ca/.../labs/lab01/MSDOS_Crash_Course.pdfCTEC1863 MS-DOS Crash Course Page 1 ... o ATTRIB -R "ANOTHER FILE.DOC"

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.

Page 2: MSDOS Crash Course - Technology at Niagara College …technology.niagarac.on.ca/.../labs/lab01/MSDOS_Crash_Course.pdfCTEC1863 MS-DOS Crash Course Page 1 ... o ATTRIB -R "ANOTHER FILE.DOC"

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.

Page 3: MSDOS Crash Course - Technology at Niagara College …technology.niagarac.on.ca/.../labs/lab01/MSDOS_Crash_Course.pdfCTEC1863 MS-DOS Crash Course Page 1 ... o ATTRIB -R "ANOTHER FILE.DOC"

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.