Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: MS-DOS Tutorial  (Read 174606 times)

0 Members and 1 Guest are viewing this topic.

Dilbert

    Topic Starter
  • Moderator


  • Egghead

  • Welcome to ComputerHope!
  • Thanked: 44
    MS-DOS Tutorial
    « on: September 21, 2006, 05:01:14 PM »
    ***Third backup from recovery***

    This tutorial is for the reader should who wish to explore MS-DOS and its somewhat limited - yet extremely powerful - features. This tutorial set will cover:

    Overview: Why I made this lengthy tutorial
    Most of the information available in this tutorial is available in ComputerHope records. In fact, I usually will have a ComputerHope window open for switch reference while I write. So why bother making this at all? I have several reasons: 1) Psychotic urges compel me to write QA threads, 2) The information provided is arranged by skill level, not alphabetically, and 3) I don't like the format the CH database uses. I should elaborate on #3. While the CH database has a wealth of information, most of the examples are at the bottom of the page, not next to any descriptions on the various switches. I don't know about you, but I find it much easier to understand when an example is right next to the information. So, instead of saying, "Here's A B C and D. Here's how to use A, B...", I say, "Here's A and how to use it. Here's B and how to...". This way, the information is on your mind as you read about its applications. Not to mention the fact that unlike websites, if you don't understand a command you can Private Message the author (me) and I will be happy to answer your questions/concerns.

    MS-DOS: What is it?
    The literal definition is that MS-DOS stands for "Microsoft Disk Operating System". The answer most readers are looking for is that DOS is a command-line method of executing basically the same functions available in Windows. The main difference is the lack of wizards, the need to be precise, and the fact that DOS came first. However, DOS has much more power than your standard Windows, and if you know the right commands, you can get information much more quickly. With this in mind, let us begin...

    NOTE: As I have Windows XP I do not have access to "true DOS", only the Command Prompt. However, the information provided should be accurate; if it is not, please send me a Private Message and I will correct it.
    « Last Edit: March 30, 2007, 03:15:26 AM by Dilbert »
    "The geek shall inherit the Earth."

    Dilbert

      Topic Starter
    • Moderator


    • Egghead

    • Welcome to ComputerHope!
    • Thanked: 44
      Re: QA0035 MS-DOS Tutorial
      « Reply #1 on: September 21, 2006, 05:01:36 PM »
      I. THE BASICS OF MS-DOS

      Navigating folders and Simple Commands
      Depending on whether you are using the Prompt or "true DOS", you should see a prompt similar to this:

      C:\>

      or this:

      C:\Documents and Settings\Yourname>

      Regardless, you are ready to get started.

      Seeing what is in your current directory
      Obviously, you have to be able to see what you're doing or else you are "shooting in the dark" with no idea what to do. Luckily, there is a command to show what is in your current directory. Type DIR and press [Enter] to activate this fuction. It should look like this:

      C:\>DIR

      The results I got in C:\ were:

       Volume in drive C has no label.
       Volume Serial Number is 8C87-FFA1

       Directory of C:\

      04/18/2006  12:06 AM                 0 AUTOEXEC.BAT
      04/21/2006  04:42 PM    <DIR>          Batch
      04/18/2006  12:06 AM                 0 CONFIG.SYS
      04/18/2006  12:21 AM                32 csb.log
      04/21/2006  07:45 PM                 0 dir.txt
      04/18/2006  12:12 AM    <DIR>          Documents and Settings
      04/18/2006  12:45 AM    <DIR>          NVIDIA
      04/21/2006  04:27 PM    <DIR>          Program Files
      04/20/2006  08:01 PM    <DIR>          WINDOWS
                     4 File(s)             32 bytes
                     5 Dir(s)  196,047,323,136 bytes free


      The items with <DIR> are directories, or folders. Anything else is a file. The column on the left is the date the files were last changed, the next column shows the time the files were modified. The number to the left of the file name is the size of the file in bytes.

      If there are too many directories to list on one screen, type one of the following commands:

      DIR /w
      OR
      DIR /p

      The /w switch makes the DIR appear in a wider format, while /p displays the DIR one screenful at a time.

      Changing directories
      OK, you want to leave the directory you're in. No matter how exciting it gets, C:\ isn't going to be exciting enough as there is not all the information you need in the root. To change directories, type CHDIR [directory name] or CD [directory name], replacing [directoryname] with the name of the directory you wish to go to. So, on my pc, if I want to change to C:\NVIDIA, I type

      C:\>CD NVIDIA

      The prompt changes to

      C:\NVIDIA>

      Opening files
      In the Command Prompt, these files will run outside of cmd.exe. In true DOS, this is obviously not the case, but only DOS-friendly files may be run. To open an EXE file, simply type the name of the EXE file, and it will run. So, If I'm in C:\Program Files\Chami\HTML-Kit\ and I want to run HTML-Kit from Command prompt, I would type

      C:\Program Files\Chami\HTML-Kit>HTML-Kit.EXE

      and the program would run. To access a text file, you would use the TYPE command:

      C:\>TYPE dir.txt

      and the information would display on my command screen. Note, however, that some text files may be too long for the screen. For files like this, type the following command:

      C:\>TYPE dir.txt | more

      Replacing dir.txt with the name of the file you want to display. The | key is found above the [Enter] key ([Shift] and \). When the file reaches the size of the page, it will pause, asking you to press [Enter]. Pressing [Enter] will move the page down one line. If you change your mind partway through reading the long file, Press [Ctrl] and C. You will go back to the prompt.

      The TYPE command works with virtually any kind of file, but note that you will not be able to read all of them. Compiled EXE files will show strange characters, as will .dat and other files. Do not worry, no harm is done.

      Clearing the screen
      If you don't like clutter, press CLS at any time. This command clears the screen of everything but the latest prompt.
      « Last Edit: March 28, 2007, 05:14:45 PM by Dilbert »
      "The geek shall inherit the Earth."

      Dilbert

        Topic Starter
      • Moderator


      • Egghead

      • Welcome to ComputerHope!
      • Thanked: 44
        Re: QA0035 MS-DOS Tutorial
        « Reply #2 on: September 21, 2006, 05:01:57 PM »
        Creating files

        So far, if you are following this tutorial in a linear fashion, you have not changed anything; you have only taken a look at how the files are stored and where. Here, you will learn two ways of adding to your system in a way that cannot harm your system at all: Creating files.

        This is a part of MS-DOS that is more powerful than Windows. In Windows, you can only create the extensions listed on the "New" menu. In MS-DOS, you can create any file extension you want, including extensions not recognized by Windows. They can still be read, however, from Windows if you open it with a program like Notepad.

        To create a file using the Copy Con method, type at the prompt:

        COPY CON Newfile.txt

        Replace Newfile.txt with any file name and extension you choose and press [Enter]. At first, nothing will seem to happen. You will need to press [Control] and Z. The symbol ^Z will appear. Press [Enter] to confirm. What you see should resemble this when you are done:

        C:\>COPY CON newfile.txt
        ^Z
              1 file(s) copied.
        C:\>


        Another method is the Edit method. Simply type:

        EDIT newfile.txt

        You will be taken to a blue window, MS-DOS's first attempt at a GUI. Type whatever you want, then go to File and click Save. Then go back into File and click Exit. The file is created.

        A note about the EDIT method: If the file already exists, you will see that file's contents instead of a blank blue screen. It is not recommended that you change what's there unless you know what you are doing.
        "The geek shall inherit the Earth."

        Dilbert

          Topic Starter
        • Moderator


        • Egghead

        • Welcome to ComputerHope!
        • Thanked: 44
          Re: QA0035 MS-DOS Tutorial
          « Reply #3 on: September 21, 2006, 05:02:23 PM »
          Editing files
          Editing files is as easy as the Edit method for creating files. For repitition's sake, simply type:

          EDIT file.txt

          You will be taken to a blue window, MS-DOS's first attempt at a GUI. Type whatever you want, then go to File and click Save. Then go back into File and click Exit.

          You, of course, can edit and change the file's contents just like the Windows Notepad. The only thing that must be said about the EDIT command is that it is the only way to edit files in true DOS, however, in the Prompt it is almost useless; you can open any file you want in Notepad, Word or some other program.

          The EDIT window toolbars:

          FILE

          New - Creates new file.
          Open - Opens another file for editing.
          Save - Saves with current filename.
          Save As - Saves with filename you choose.
          Close - Closes the document but not the EDIT window.
          Print... - Allows you to send the file to a printer.
          Exit - closes the EDIT window returning you to the prompt.

          EDIT

          Cut - Removes selected text but keeps in in memory (known as the clipboard). Only one string of text may be kept in mempry at a time.
          Copy - Same as Cut, but leaves the original intact.
          Paste - Whatever is in the clipboard is placed at the cursor.
          Clear - Removes selected text without commiting it to memory.

          SEARCH

          Find... - Finds all instances of whatever keyword you enter.
          Repeat last find - Does exactly what it says.
          Replace... finds all instances of a keyword or phrase, allowing you to replace them with another phrase/keyword you enter.

          OPTIONS

          Settings - Allows you to specify how many tab stops on the page and what port the printer is on.
          Colors - Allows you to change what color text, the background, etc. is.

          HELP

          Commands - Lists available commands in the EDIT window.
          About - shows the version of the editor.
          "The geek shall inherit the Earth."

          Dilbert

            Topic Starter
          • Moderator


          • Egghead

          • Welcome to ComputerHope!
          • Thanked: 44
            Re: QA0035 MS-DOS Tutorial
            « Reply #4 on: September 21, 2006, 05:03:28 PM »
            Renaming a file
            Oh no! You wanted to create coolstuff.txt but you accidentally created cookstuff.txt! How do you fix it? Better get rid of it and start over, right? No! Windows has a handy Rename feature, and so does DOS.

            To use the Rename feature, type RENAME, the file's current name, and the new one. The syntax (proper order/method of issuing commands) for this example is this:

            RENAME cookstuff.txt coolstuff.txt

            The file will be named the way you want it to. This command also works with directories. Say I have the directory C:\Blark but I want it to be C:\Bark. It is done like this:

            RENAME C:\Blark bark

            A shorter method of renaming files is REN. It does the same thing as RENAME and works the same way; it's just shorter. Use what works for you.

            It is also possible to change the extension of your file with the REN* command. Simply specify it like so:

            REN file.txt file.doc

            The file is renamed as a different file type.

            NOTE: In older versions of "True DOS", the REN* command is not available. You will have to use the MOVE command, if this is the case (covered later).

            *Throughout this tutorial, I msy make reference to only the shorter version of the command. This is not to say that the longer version cannot perform the function - merely that I choose the short version for convenience's sake.
            "The geek shall inherit the Earth."

            Dilbert

              Topic Starter
            • Moderator


            • Egghead

            • Welcome to ComputerHope!
            • Thanked: 44
              Re: QA0035 MS-DOS Tutorial
              « Reply #5 on: September 21, 2006, 05:04:09 PM »
              Copying files
              OK, so you got a file on C:\ but you really want it on C:\Backups. BUT... you don't want to lose the original. Here's where the COPY feature comes in handy. The syntax is:

              COPY [source] [destination]

              So, the syntax for copying to C:\backup would be

              COPY file.txt C:\Backup

              There are switches for this command which alter the copy somewhat. A switch is any modifier to the command; they are expressed usually after the entire command, as a / and a letter or number. In this case, the switches are:

              /A - Means the file is a ASCII file. (COPY ascii.txt C:\Backup /A)
              /B - Means the file is a binary file. (COPY binary.bin C:\backup /B)
              /V - Makes sure the files are copied correctly. (COPY file.txt C:\Backop /V(Produces error as there is no C:\Backop))
              /Y - "Quiet" mode; if you overwrite a file you will not be informed. (COPY text.txt C:\Backup /Y)
              /-Y - Makes good and sure you know if there is an overwrite. (COPY file.text C:\Backup(Causes warning if the file exists there already))

              It is also possible to copy multiple files at the same time. Let's say you wanted to copy all the files in C:\Backup to A:\ (a diskette). To do this:

              COPY C:\Backup\*.* A:

              To combine specific files, do this:

              COPY file1.txt+file2.txt

              This will add all of file2.txt to the end of file1.txt

              XCOPY - The Next Generation

              XCOPY is a powerful version of COPY which has more versatility, switches, and is therefore a must-have. For simple commands, COPY is sufficient. However, XCOPY works exactly the same, but with more features. The XCOPY switches related to files are:

              /A - Copies only files with the Archive attribute.
              Got a ton of files with the archive attribute? OK, maybe just one or two. Use this to pick them out of the bunch.
              /M - Copies only files with the archive attribute, but the destination copy does not have the Archive attribute; it is removed.
              /D:Date - Copies only the files dated after the date mentioned (replace date with the date, i.e. 010104 is Jan. 1, 2004).
              Need to update your backups, but only the new ones? Perfect.
              /P - Asks permission before creating each destination file.
              Control freak? Wanna make sure you're copying what you want to copy? This switch is for you.
              /W - Asks you to press a key before copying.
              Good for batch files (covered later). If you need to make sure the user is OK with a copy, this will work out nicely.
              /F displays source and destination names while copying.
              Good for if you need to see what all is being copied.
              /L - Displays files that would be copied. Does not actually copy.
              Good for a "preview" function.
              /H - Copies hidden and system files as well as normal files.
              This will help make sure you have everything in that folder.
              /U - Updates the files instead of overwriting them - makes the destination files the same as the source.
              Great for backups.
              /K - copies all attributes over.
              Normally, the attributes like "read-only" are taken off during XCOPYing. With this switch, all attributes are preserved.

              You can see why XCOPY is considered so powerful; it truly is! Usually, however, a normal COPY will be suitable for your purposes.
              « Last Edit: September 21, 2006, 05:04:28 PM by Timothy_Bennett »
              "The geek shall inherit the Earth."

              Dilbert

                Topic Starter
              • Moderator


              • Egghead

              • Welcome to ComputerHope!
              • Thanked: 44
                Re: QA0035 MS-DOS Tutorial
                « Reply #6 on: September 21, 2006, 05:05:19 PM »
                Moving files
                Let's say you have a file in C:\ but it needs to be in C:\Pictures. You could copy it, and then go back and delete the original. But there is an easier solution.

                NOTE: I cannot verify this, but I believe that some really really old versions of DOS do not support a MOVE command. If you are one of these accursed (;)) people, I have written a batch file called XMOVE. It's as versatile as MOVE and has the same syntax, except no switches are available for XMOVE. Download XMOVE here. Stick the .BAT file in C:\WINDOWS\System32 as a quick install.

                The MOVE command is exactly like Copy, except that the original, the source, is deleted. The syntax is:

                MOVE [source] [destination]

                The only switches are the /Y and /-Y, which serve the same function as the /Y and /-Y in the COPY command. As with COPY, you can move multiple files elsewhere.
                « Last Edit: October 01, 2006, 04:45:15 PM by Timothy_Bennett »
                "The geek shall inherit the Earth."

                Dilbert

                  Topic Starter
                • Moderator


                • Egghead

                • Welcome to ComputerHope!
                • Thanked: 44
                  Re: QA0035 MS-DOS Tutorial
                  « Reply #7 on: September 21, 2006, 05:05:47 PM »
                  Removing files
                  That dumb test.txt file is taking up valuable space on your hard drive! What's worse is, you don't need it anymore! Great, just great. How does one remove it? Well, it can be done with one of not one, not two, but three commands. The following three are all in correct syntax and do the exact same thing:

                  DEL test.txt
                  DELETE test.txt
                  ERASE test.txt


                  Each of these will destroy the file test.txt. Gone. Permanently*.

                  The possible tags are:

                  /P - Asks before deleting each file.
                  For those times when you really want to be sure.
                  /F - Forces read-only files to be erased as well.
                  /S - Deletes all specified files in that folder and any subdirectories with the same name.
                  /Q - Do not ask to delete on global wildcard.
                  Normally, if you choose to "DEL *.*" (deleting all files with all extensions), you are given a prompt that says
                  Are you sure?(Y/N)
                  Using the /Q switch disables this prompt for this particular delete.
                  /A - Deletes based on attributes.
                  DEL *.* /AR would delete only read-only files
                  DEL *.* /AH deleted only hidden files
                  DEL *.* /AS removes only system files
                  DEL *.* /AA erases only archives files
                  DEL *.* /-H erases everything but hidden files (the "-" prefix can work with any attribute)

                  Note: Deleted files in DOS do not go to any Recycle Bin or Trash Can. They are erased.

                  *There is an un-delete command, but success is hardly reliable. Delete with caution.

                  Creating, Renaming and Removing directories
                  What!?! The directories you have aren't good enough for you? Sheesh!

                  Just kidding. It's a fact of life that no matter how much we have, at some point we will need more. So, it is possible to create more directories. There are two codes that do the same thing:

                  MKDIR [directory name]
                  MD [directory name]


                  Either way, a new directiry is created for you to store files in. So, if you need a directory for all of your pictures. So, you could type

                  MD Pictures

                  and a directory with that name would be created.

                  To rename a directory, use the REM command. If you misspell Pictures, say, Pictyres, you can enter the command

                  REM C:\Pictyres Pictures

                  Boom! Directory renamed.

                  If you want to remove a directory, you can use the RMDIR or RD command:
                  "The geek shall inherit the Earth."

                  Dilbert

                    Topic Starter
                  • Moderator


                  • Egghead

                  • Welcome to ComputerHope!
                  • Thanked: 44
                    Re: QA0035 MS-DOS Tutorial
                    « Reply #8 on: September 21, 2006, 05:06:13 PM »
                    RMDIR [directory name]
                    RD [directory name]


                    Normally, only empty directories, with no files or sub-directories in it, can be removed. The switches for RMDIR/RD are:

                    /S - removes all files and subdirectories
                    /Q - Used with /s: Does not prompt when removing directories/files.

                    NOTE: The above swittches only wirk with Windows 2000/XP. To remove entire directories, including files, in earlier versions of Windows or DOS, see the DELTREE command (covered much later)
                    "The geek shall inherit the Earth."

                    Dilbert

                      Topic Starter
                    • Moderator


                    • Egghead

                    • Welcome to ComputerHope!
                    • Thanked: 44
                      Re: QA0035 MS-DOS Tutorial
                      « Reply #9 on: September 21, 2006, 05:06:34 PM »
                      II. Intermediate MS-DOS.
                      This tutorial set assumes you are familiar with the basic functions of DOS. If you are not, please review section I.

                      Copying directories and directory trees

                      So, you have a whole load of files in a bunch of directories, and they all stem from C:\Documents. You need the entire thing, from C:\Documents\ down to the last subdirectory and file, copied to a diskette or another drive. Sounds difficult, but it really isn't.

                      XCOPY strikes again

                      XCOPY has a lot of power concerning the copying of files, but XCOPY, unlike COPY, is capable of copying directories as well. The switches for XCOPY regarding directories are:

                      /T - Copies directory tree, but no files. /T by itself does not include empty source directories.
                      /S - Copies all directories except for empty ones, along with the files they contain.
                      /E - Forces XCOPY to copy empty directories as well. Can be used with /T or /S.

                      So, if you wanted to copy every cotton-picking thing in C:\Documents, you would do something like this:

                      XCOPY C:\Documents\*.* A: /S /E

                      A note to Windows Users: Sometimes XCOPY has a problem with copying Internet Explorer favorites. This is because IE tends to violate the 8.3 format by using long file names with extensions of more than three digits. If this does not work and regular COPY does not work, then there is no way of copying that favorite. However, if you are in the Recovery Console attempting to save your computer's files before you format the disk, it's a small loss.
                      « Last Edit: March 28, 2007, 05:15:56 PM by Dilbert »
                      "The geek shall inherit the Earth."

                      Dilbert

                        Topic Starter
                      • Moderator


                      • Egghead

                      • Welcome to ComputerHope!
                      • Thanked: 44
                        Re: QA0035 MS-DOS Tutorial
                        « Reply #10 on: September 21, 2006, 05:06:56 PM »
                        IP information
                        As you may know, your IP address is your unique computer signature on the net. Even if your PC does not have access to the Internet, you still have an IP address for "just in case". Sometimes, it is necessary to retrieve or modify this information. To see all the information you will need, use the command

                        ipconfig /all

                        This will display, among other things, your IP address, Subnet Mask, Default Gateway, etc.. You should also see info about any Ethernet Adpapters or Wireless Adapters you have. You may or may not have more than one adapter; most PC's just have the one.

                        So, if you need to renew your IP address in order to troubleshoot or some such thing, type

                        ipconfig /release

                        If you have more than one adapter, specify the number of the adapter like so:

                        ipconfig /release 0

                        replacing 0 with the number of your adapter. This command gets rid of your IP address. Now, type

                        ipconfig /renew

                        if you specified a number when you released, then you should specify that same number again.
                        "The geek shall inherit the Earth."

                        Dilbert

                          Topic Starter
                        • Moderator


                        • Egghead

                        • Welcome to ComputerHope!
                        • Thanked: 44
                          Re: QA0035 MS-DOS Tutorial
                          « Reply #11 on: September 21, 2006, 05:07:19 PM »
                          Simple Batch Files
                          To say that batch files are simple is like saying the ocean is water: It can be true, but there's usually more to it than that. Some batch files are easy and simple, requiring little actual coding. Others seem to be the code version of essays.

                          Before you can make a batch file, you need to know a bit about them. Batch files are really nothing more than a series of DOS commands strung together. When the batch file is executed, all of the commands are run. There are a series of commands that may work in the prompt, but are more suited to batch files. They are:

                          ECHO - displays whatever comes after the word "echo".
                          ECHO. - Displays a blank line.
                          REM - A comment, not parsed.
                          @ - Modifier that hides commands. Normally, when a command is issued from a batch file, you see the text of the command, then the results. This forces a "quiet mode".
                          PAUSE - Pauses the batch file until a key is pressed

                          There are others as well, but for simple batch files this should be enough.

                          To use a batch file, create a file with a .bat extension. Review Creating Files if you are unsure of how to do this. If you are using a Prompt, you can either use the EDIT command or use Notepad. True DOS users are stuck with the EDIT function.

                          The first line of a batch file is usually the line "@ECHO OFF". This line makes in unnecessary to use a "@" for the rest of the batch. For simplicity's sake, as an example we will write a batch file which clears the screen, displays the directory's contents in a wide format and displays a custom message. Each command must be on it's own line.

                          Code: [Select]
                          @ECHO OFF
                          CLS
                          DIR /W
                          ECHO Wide format on clear screen courtesy of Dilbert!

                          Replace Dilbert with your name in the above example, and you'll have a perfectly good batch file with a specific function. Play around with different DOS command variations; be creative. See what utilities you can create. A few ideas:

                          • Change directories to a specific folder, give the contents, and pause, clearing the screen on resume.
                          • Write a short essay on how to do something in DOS and use the ECHO command to display it.
                          • Make a file that creates a file, allows you to edit it, and then make a backup using the COPY command.
                          "The geek shall inherit the Earth."

                          Dilbert

                            Topic Starter
                          • Moderator


                          • Egghead

                          • Welcome to ComputerHope!
                          • Thanked: 44
                            Re: QA0035 MS-DOS Tutorial
                            « Reply #12 on: September 21, 2006, 05:07:49 PM »
                            Output command to a text file
                            OK, so you want to make a log of what a batch file does. Or, you want to make an example of what a command does because you're making a MS-DOS FAQ and you want the format to look just right so the readers won't be confused. For whatever reason, you want to get the output - the results of the command - into a text file.

                            Doing this is deceptively easy. Type the command, then add >> and the name of the text file. Example:

                            DIR >> log.txt

                            The DIR results will not display on the screen, but instead will place DIR info in log.txt.

                            NOTE: This may not work for you. If it doesn't, use only one ">" instead of two. Classically, one > is used to create the file and >> is used to append to it. Depending on your DOS/Prompt version you may be able to get away with only using >>'s. Your milage may vary.
                            "The geek shall inherit the Earth."

                            Dilbert

                              Topic Starter
                            • Moderator


                            • Egghead

                            • Welcome to ComputerHope!
                            • Thanked: 44
                              Re: QA0035 MS-DOS Tutorial
                              « Reply #13 on: September 21, 2006, 05:08:03 PM »
                              Attributes
                              For whatever reason, you may want to make it so that nobody can modify a file. Or, maybe hide it from view. This is where the ATTRIB command comes in handy.

                              The use of this command varies from Operating System to Operating System, but they are similar:

                              In Windows 9x and Windows ME:

                              + - adds attribute.
                              - - Removes attribute
                              R - Read-only (cannot be modified while attribute is set)
                              ATTRIB +R nochange.txt (adds attribute)
                              ATTRIB -R change.txt (removes attribute)

                              A - Archive
                              S - System file
                              H - Hidden file
                              /S - Sets attribute to all files in all folders in specified path.

                              ATTRIB +H file.txt /S (sets all files in current directory and below as hidden)

                              In Windows 2000 or XP:
                              Same as Win95, 98 and ME with one addition:

                              /D - makes all folders this attribute as well.

                              In Win2000 or WinXP Recovery Console:
                              Same as above except:
                              1. The Archive attribute is unavailable
                              2. The /S and /D switches are unavailable
                              3. The Compressed attribute is available (ATTRIB +C file.txt)
                              "The geek shall inherit the Earth."

                              Dilbert

                                Topic Starter
                              • Moderator


                              • Egghead

                              • Welcome to ComputerHope!
                              • Thanked: 44
                                Re: QA0035 MS-DOS Tutorial
                                « Reply #14 on: September 21, 2006, 05:08:27 PM »
                                III. Advanced MS-DOS
                                This tutorial set assumes that you have been reading the other tutorials and/or have a decent understanding of how MS-DOS works and that you are very comfortable with using MS-DOS. If this is not the case, it is recommended that you review any topics you are unfamiliar with.

                                Formatting
                                You want to use a diskette but you're getting a "unrecognized file system" or similar error. Or, you're in the recovery console and you need to wipe your drive clean (presumably after backing up data). You can do this in the prompt by using the FORMAT command.

                                WARNING! FORMATTING DESTROYS ALL DATA ON THE SELECTED DRIVE! BACK UP ALL POSSIBLE DATA BEFORE CARRYING OUT THESE PROCEDURES!

                                For safety's sake, we will assume you are not going through the turmoil of the recovery console. Either way, it's almost the same.

                                FORMAT A:

                                The above command would format your diskette drive. If you buy a new disk, even if it says it's formatted, you should use this command before using the diskette for the first time. If you just want to erase data, use the following:

                                FORMAT A: /Q

                                This forces a "quick" format. Other switches are Operating System specific. On Windows 9x/ME, you generally should choose your preference between the following:

                                /V:label - Replace label with any name, and the disk will be labelled that name.
                                /B - Makes the disk a "System" disk.
                                /S - Copies system files to the disk.
                                /C - Files placed on the disk are compressed by default.

                                With Win2000 and WinXP, the options are a little different:

                                /FS:filesystem - Replace filesystem with FAT, FAT32, or NTFS; the file system specified will be used in the format. Only use this if you are sure of what file system you want.
                                /Q - Same as Win9x / ME.
                                /C - Same as Win9x / ME.
                                /X - Forces drive to dismount (no longer be recognized by the system) if needed. This is temporary and only in effect during the format.

                                In the Win2000/XP Recovery console, you only have access to /Q and /FS:filesystem.

                                So, to format C:, and make sure it's an NTFS file system, and give it a label of "WindowsXP", the command would be:

                                FORMAT C: /FS:NTFS /V:Windows

                                It is STRONGLY recommended that you NOT use the above command unless you are sure you want to do this. You will lose everything on your boot drive, all files, etc. Make a backup of important files before you begin.

                                If you wish to practice this command, you should do so on a (preferrably blank) diskette. This way, you cannot harm your system nor will you lose important files.
                                « Last Edit: March 28, 2007, 05:16:18 PM by Dilbert »
                                "The geek shall inherit the Earth."