GUI is the most widely used interface to date. The number one reason why most people prefer GUI over CLI is because it is much easier to navigate in. In fact, navigating is the reason why GUI exists at all. Using pictures and graphics to represent objects and being able to click on them to open them is much easier than having to type in some command.
Navigating in CLI has a higher learning curve. Instead of clicking, you need to type in a command. Instead of browsing, you need to know the exact path you are going into. Sounds hard, doesn’t it? But, don’t fear! It is actually quite easy. The GUI of Windows, for the most part, is based on the CLI of DOS. So, the good news is that since you have been working with Windows and GUI, just changing the terminology a little and you can understand how to navigate in CLI.
Every file on your computer is organised; it has to be. In the computer world, no matter what platform, every single file needs to have its own unique name. You cannot have two files named report.txt. However, it seems as though every program that you have installed on your computer has a file named setup.exe. But how? Well, in the GUI world, these files can be separated in their own folders. Thus, a path is created to the file, and that path is part of the actual file name. So, c:\program1\setup.exe and c:\program2\setup.exe are two completely different names, therefore can exist on the same computer.
The reason why the names has to be unique is so the operating system can distinguish between the two files and can open the correct one if prompt. Most operating systems are case sensitive. This means that setup.exe, Setup.exe, setup.EXE and Setup.Exe are all different file names. Windows, on the other hand, is not case sensitive. Setup.exe, setup.exe, setup.EXE and Setup.Exe is the exact same file name in Windows. You can change the case on file names if you want, but you cannot put setup.exe and setup.EXE in the same folder, unlike other platforms.
OK, right-click you desktop and create a new folder. You may call it anything you want, but you might want to call it ‘batch files,’ because I will use it as an example now and in later posts. Now, open it and look at the address bar. If you cannot see your address bar, it might not be enabled. To enable it, goto view->toolbars and make sure ‘address’ is checked. See the picture below:
On my computer, the address bar says ‘c:\documents and settings\rich\desktop\batch files’.
The address is the current path you are at on your computer. On my computer, I am in the ‘batch files’ folder I created, which is located on the desktop. There is a folder that is called ‘desktop.’ This folder is located under ‘rich’, which is in ‘documents and settings’ which is on the c drive. Instead of just opening the folder on the desktop, you can browse to it by opening up ‘my computer,’ then double-click on c:, ‘documents and settings’, ‘rich’ (or what is on your computer), ‘desktop’, and ‘batch files.’ The folder is ‘documents and settings’, while ‘rich,’ desktop,’ and ‘batch files’ are sub-folders.
That path is very important to know when working with CLI, because that is what you would be using on that interface. There are no graphics, so there are no folders to click onto. In CLI, there are no folders. Instead, they are called directories. A directory is a way to organise files into groups, usually by relevance. For example, all files that make up one particular program will usually have all those files grouped into a directory. A folder is a graphical representation of a directory. However, folders and directories are one and the same. It is important to know the terminology, however, because GUI uses the term ‘folder’ and CLI uses the term ‘directory.’ Therefore, the commands in those interfaces will use the correct terminology based on what interface you are using.
A directory can reside inside a directory. This is called a sub-directory. A graphical representation of a sub-directory is called a sub-folder. However, there is some good news. I have yet to see a command where you would have to type in a distinguish between a directory or a sub-directory. It’s just good to know that terminology, so you sound like you know what you are talking about
.
OK, now we are going to work with CLI. Go to start->run, type in cmd and hit enter. A command window should appear. Notice to the left of the flashing cursor. What does it look like? That’s right, it is a path, just like in the address bar in the folder you created on your desktop. On my computer, it says ‘c:\documents and setings\rich>’. This is called the working directory. The working directory is the directory in which you are currently located, or working in. By default, you are in your home directory. We are going to go in one of the sub-directories in your home folder. But, how do you know what is in the directory? Well, there is a command called dir. Dir, short for ‘directory,’ displays the content of a directory. So, type in dir and press enter. It lists the sub-folders and files inside your home directory. You can also span all of the sub-directories so that you can see the content inside those as well. The tree command lists every content in a directory and sub-directories in a tree structure. Go ahead and type in tree.
Let’s go to the batch files folder. In order to change the directory, there is a command called cd (change directory). Type in cd desktop and press enter. You are in your desktop folder. Since ‘batch files’ has a space in it, you need to place quotes around it so that CLI knows that it is one name. So, you can do this one of two ways; either type in cd “batch files” or cd bat followed by pressing the tab key. The tab key will finish what you were going to type, as long as there is nothing else on you desktop that begins with ‘bat’. Now, press enter to go in the ‘batch files’ directory.
OK, we are now in the ‘batch files’ directory. What if we want to create another directory inside it? It is simple, there is a command for that. The mkdir command makes a directory. So, go ahead and type in mkdir newdirectory and press enter. Now, type in dir to make sure that it was created. Oh no! The directory is a few seconds old, so it should be called the ‘olddirectory,’ Ahhh!! That’s OK, because there is a command for that. The rename command renames a file or directory. So, type in rename newdirectory olddirectory and press enter. Type in dir to make sure the change has taken place.
SIDENOTE: Notice that when renaming, you typed in the ‘name from’ name first, then the ‘name to’? Most commands work like that. You would type the source location first, then the destination location if you were to move something. Most commands, when applicable, works in this fashion.
OK, we are done with this directory, so we are going to delete it. But, before we do that, here is my disclaimer:
WARNING: SOME COMMANDS CAN ERASE OR CORRUPT DATA. MAKE SURE WHEN ATTEMPTING THE NEXT COMMAND, MAKE SURE YOU ARE AT THE RIGHT PLACE AND TYPE IN EXACTLY WHAT I TELL YOU TO TYPE. I AM NOT RESPONSIBLE FOR ANY DATA LOSS. AND, DELETING DATA DELETES DATA, NOT SEND IT TO THE RECYCLING BIN!!!!!!
Ok, there are two commands we can use: rd removes (or deletes) a directory and erase deletes a file or folder. NOTE: erase will confirm deletion if you are deleting a directory. Type in either rd olddirectory or erase olddirectory. Type in dir to confirm the deletion.
When you type in ‘dir,’ do you notice the dots at the top of the list? These are actually shortcuts, or ‘pointers.’ One dot is a shortcut to the current directory you are working on. This is useful if you are moving a file or folder to the current directory, or if you need to reference it in another command. Two dots is a reference to the directory right above the one you are working on. type in ‘cd ..’ . You should now be back to the desktop folder.
The path we were using to move around is not the full path. The full path to the ‘batch files’ directory on my computer is ‘c:\documents and settings\rich\desktop\batch files’. This path is called the absolute path. Typing in ‘cd’, followed by the absolute path, will bring me into that directory. However, since we are already in the desktop directory, we can type in ‘cd “batch files” instead of typing in the whole absolute path. This path is called the relative path. It is the path that is relative to the working directory. When writing scripts, it is necessary to know the difference. Sometimes, you need access to a file that is at a specific place on the computer, no matter where the batch file is started at. Sometimes, you need access to a file inside the directory of the script file, and you might or might not know where the directory is going to be at.
Well, this concludes this post. Hope it helps! If you want a more detailed explanation of each of the commands we used, just type ‘help’ followed by the command. Each of the commands we used has options we can change. I will discuss this at a later posting.
Join the forum discussion on this post

