Episode: 3510 Title: HPR3510: Syntax, Switches, and Help Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr3510/hpr3510.mp3 Transcribed: 2025-10-25 00:43:57 --- This is hacker public radio episode 3,510 for Friday, the 14th of January 2022. Tid's show is entitled, syntax switches and help and is part of the series DOS it is hosted by AUKA and is about 20 minutes long and carries a clean flag. The summary is, we continue our look the old warhorse, DOS this time it is syntax switches and help. This episode of HPR is brought to you by archive.org. Support universal access to all knowledge by heading over to archive.org forward slash donate. Hello, this is AUKA for hacker public radio and I'm inviting you to enjoy another exciting episode in our DOS series and what we want to do today is we're going to take a look at syntax and switches for the commands and the help system. This is important and the reason it's important is we're looking at a system that is entirely text based it's all command based and there's a joke that the good news about computers is that they do exactly what you tell them to do. The bad news is that they do exactly what you tell them to do. So you know every command in DOS must be entered in a precise manner and that precise manner is what we call syntax. Failure to follow the syntax precisely will most often result in an error message but in some cases it can be disastrous. So it pays to learn how the syntax works. Now first of all you have your command name. In previous lessons we listed the various internal and external commands that are available to you. In a few cases there are shortcut command names particularly for directory operations. For instance to create a directory you could use the command MKDIR for make directory or you could use the shortcut MD. Now where there are shortcut command names they are listed in the tables that we gave in the previous lessons but you must spell the command correctly. Now on the website you'll see that I've adopted the convention of typing all command names and capital letters. Now it turns out you do not need to do that. In fact anything you type is converted to all capital letters before it is processed. That's simply the way they did it. You know back in that day everything relied on you know simplifying and reducing storage and everything else so you can type in lowercase letters if you wish it makes no difference. Now after the command name you must leave a space. Now that's what tells the operating system that you are finished with the command name and are ready to enter the next part of the command. Now DOS separates the parts of the command with a blank space. That is why you could never use blank spaces in file names in DOS and Windows up through Windows 3.x. The operating system interpreted the space as a separator between parts of the command. Unix still works that way which is why you should not use spaces in Unix file names. You often see underscore used instead to represent a space in a file name. Now I think these days many of the Unix systems have finally come around to letting you use spaces. It's still a questionable practice. You know remember I wrote these tutorials 25 years ago and at that time you would not use spaces in any kind of a Unix system. Now after the command name drive designation now drives are represented by letters in DOS. Other operating systems have different conventions but in DOS the first two letters A and B are reserved for floppy disk drives. Early DOS computers you know my first DOS computer was an XT and did not have hard drives. It had two floppy drives. So you would stick your stick one disk. I'll use the reason I bought it was so I could use word perfect to work on my doctoral dissertation. So that was a requirement of the fellow who agreed to be the chair of my committee. You said I'll only do that if you buy a computer and get a word processor because otherwise neither of us will live long enough for you to finish. Wise words. So you would put your word perfect program disk in one of the drives and your data disk to hold your files in the other drive. And so that way it was pretty easy to open up the program, start creating documents and then save them to a different floppy disk. Now that's why the hard drive to this day is still the case in Windows systems. The hard drive is always the C drive because A and B were already taken. C was just the next letter. Now I mean these days you don't even see a computer with a floppy disk. I wouldn't know what to do with one anymore. But it's still the C drive. Now note that drive designations must always be followed by a colon. So for example if you're a booted, suppose the C colon drive is you're working your recovery, your prompt will then look something like C colon, backslash, greater than. Now you can modify that but I'm not going to get into all of that right now. But back in the day when there was not that many things you could do people used to have fun figuring out ways of modifying the command prompt and personalizing it in some way. Now let's say you're at the command prompt, C colon, backslash, greater than sign. If you then types the format command, theoretically you could wipe out your hard drive by formatting it. Now in actuality the OS would stop you in this particular case but you cannot rely on the operating system catching all of your errors. So be careful. Now if you wanted to format a floppy disk, you would insert a disk into your floppy disk drive. Let's assume it's the A drive and you were then type. Now at the prompt, the prompt is C colon, backslash, greater than sign and then you would type format space a colon. So the first part is the command name format. Followed by a space that tells the computer you're finished with the command name, then the drive designator which is a colon. That tells the OS to apply the command to the A drive. If you haven't done this before, assuming you have a blank floppy disk in a disk drive, try it. Now sometimes you want to operate the command on a directory within a drive. You can do this by adding the path you want it to follow. For instance, suppose you want to get a directory listing on a directory in your hard drive called C colon, backslash, WP backslash, documents backslash. WP is word perfect. Back in the day, that was the best thing around. Now you can get that directory listing with the following command. At the command prompt type DIR space, that's the directory command and the space says I'm done with the command and then the path C colon, backslash, WP backslash, documents. Now if you're not running word perfect, you wouldn't have this particular directory pick one you do have and try doing a directory command on it. Now sometimes you can modify a command by using what are called switches. These modify how the command behaves in some way and are always shown by a preceding forward slash. So that's an interesting difference between directories and switches is that directories everything is backslash, switches everything is forward slash. Microsoft drilled so many people into using backslash that nowadays when people are doing URLs, which of course use forward slash is 90% of the time they'll say backslash. This is because they've been brainwashed. So, okay, a switch. These modify how a command behaves in some way and are always shown by a preceding forward slash switches are the key to making DOS work for you master the switches and you can do almost anything. For instance, try doing a directory command on a large directory like say C colon backslash DOS. You should see everything scroll by on the screen very quickly until it stops on, it stops with the last screen if the directory listing. You'll find this hard to use because it went by too fast for you to see most of the listing. But you can change this behavior with a simple switch. So at the command prompt type DIR space then slash P and another space then C colon backslash DOS. Now note there's a space between the command name and the switch and between the switch and the path. DOS always expects a space between parts of the command. This switch tells the operating system to display the results one screen page at a time. The piece stands for page here. The operating system will display one page of the listing with a note at the bottom telling you to strike a key to get the next page. Now sometimes you want to apply a command to a particular file. You would then place the file name in the position of the drive, designator or path or at the end as appropriate. If you just enter a file name without other information the operating system will look for that file in the current working directory. Then in the directories listed in the path statement. If it does not find it in any of those places it is an error statement. But you can give the full path to the file and it will be found if the file is there. For example let's assume my current working directory is c colon backslash documents and it contains a text file called myfile.txt. Well you could display the contents of that file on your screen with a command. Your current working directory is there so in this case the command prompt will look like c colon backslash documents backslash greater than and that would be your command prompt because command prompt always gives you your current working directory. Then the command type type and a space and in the file name myfile.txt. And what that would do is it would display the contents of that file on your screen type always displays to the screen. Now let's suppose your working directory was the root directory c colon backslash and let's assume that the directory c colon backslash documents was not in the path statement. Well then if you at the command prompt if you typed type space myfile.txt you would get a file not found error. Now you can get around that by using the full path. So at the command prompt you'd enter type space c colon backslash documents back myfile.txt. So where do you find all of this information about syntax and switches for a docs command? Oddly enough in help system. DOS comes with a built-in help system which you activate by entering the command help. Oddly enough. If you use the help command all by itself you get a list of all the commands available and can then pick the one you want more information about. But you can also go directly to the command you want by using help followed by the command name. For instance at the command prompt type help space mkdir. Now this would give you detailed explanations of how to use the mkdir that's make directory command. What switches are available etc. It's a pretty simple command actually. Take a look at the help system what it says mkdir and then it has in parentheses the shortcut md creates a directory. You can use mkdir or md to create a multilevel directory structure syntax mkdir followed by optional drive and we know it's optional because it's in brackets that's one of the standards here and then path. So same thing with md command md optional drive and then path. What are the parameters? Drive specifies the drive on which you want to create the new directory. Path specifies the name and location of the new directory. The maximum length of any single path from the root directory to the new directory is 63 characters including the backslashes. Related commands for information about deleting a directory see the rmdir command for information about changing directories see the chdir command. So that was the actual help system entry for the mkdir command and it covers the syntax it covers parameters if there were switches it would have covered that this this particular command doesn't really have any switches. Now there are some help system conventions so as I mentioned the parameter drive was placed within square brackets this always denotes an optional parameter you can put it in or not if you don't put it in and you don't get the result you want maybe you need to put it in. But the command will work if the parameters left out but let's say you are making a directory and you didn't specify which drive guess what it's going to be something that gets made in the drive that you're currently in wherever your current working directory is. So if you want to make one into different remember I had to learn all of this back in the days of twin floppy's so it mattered whether it was the a or the b drive that you were doing. Other conventions include ellipses which means an item can be repeated as often as desired so if you see that in the help system that's worth knowing. Items separated by a vertical bar are considered either or choices. So some examples if you take a look at tree t re it has the drive optional path optional and some optional switches slash f and slash a this means that for the tree command both the drive and the path are optional and in addition there are two switches also optional. You take a look at the numlock command NUM LLCK numlock equals on vertical bar off. Now this is in brackets so it's optional but it denotes an either or choice you're either going to turn the numlock on or off. Now this command can only be used in your config sys file to set whether the numlock is turned on or turned off when you boot. Your choices are either on or off obviously. Path okay the path command if we take a look in the help system it says drive and it's in brackets so it's optional. Then path another set of brackets with a semicolon and the ellipses the three dots. So what that is saying is you can put in several different paths in the path command. Now there is an overall limit but you know you have the option of having more than one directory in your path command. Now remember the command path by itself displays the current path so any drive or path specification is optional. If you enter a drive or a path you're changing the path statement. So the outer set of square brackets makes the whole shebang optional. Now if you wish to set a path the drive itself is optional. Oh no I've always seen it used. You can add additional directories to the path as well so there's square brackets for that. Within those brackets there's a semicolon which must be used as a separator between directories in a path statement and an ellipses which tells you that you can add additional directories as needed. So with all of this information you should now be ready to start using DOS a little more intelligently. Remember to take a look at the help system. Look for the syntax and switches available and you too can be a DOS expert which I'm sure everyone wants to be. And so this is a hookah for hacker public radio signing off and as always encouraging you to support free software. Bye bye. You've been listening to hacker public radio at hackerpublicradio.org. We are a community podcast that releases shows every weekday Monday through Friday. Today's show, like all our shows, was contributed by an HPR listener like yourself. If you ever thought of recording a podcast then click on our contributing to find out how easy it really is. Hacker Public Radio was founded by the digital dog pound and the infonomicom computer club and is part of the binary revolution at binrev.com. If you have comments on today's show please email the host directly leave a comment on the website or record a follow-up episode yourself unless otherwise status. Today's show is released on the Creative Commons Attribution ShareLife 3.0 License