Command And Conquer
Exploring the Command Promp-Part2
Some common synonyms of overcome are conquer, defeat, overthrow, reduce, subdue, and vanquish. While all these words mean “to get the better of by force or strategy,” overcome suggests getting the better of with difficulty or after hard struggle. Merriam-Webster
You must first command your fear, ignorance, and failures before you can overcome. Believe you can — Then you can.
Exploring the Commands
Continue: Exploring the Command Prompt
In the previous article,
we set up the command prompt. Now Open the Windows Command Prompt in the manner you have chosen.
Type CLS_[Press enter]. This clears the screen. A few observations here. I will no longer type [Press Enter] and will type the code to enter in this manner, CD_. Command Prompt is not terribly case sensitive and I will now and then forget to capitalize the commands. As we move around the hard drive you will begin to get a feel for its structure. The prompt itself tells you your focus [location on the hard drive]. The title on my window, “Administartor: Command Prompt”, reminds me to be careful as I could change settings on my windows machine. The first Command we’ll look at is the Change Directory command. Remember Help_.
Type Help CD_. Just read it…then we’ll try a few things and discover “wildcards”. Lets just see what it does.
Now type CD_ ,CD.._ , CD system32_ , CD\ . Note what happens at the prompt. Just the command alone tells you what the path to your focus directory is, CD.. moves you up one subdirectory, CD\ moves you to the root directory. CD Windows moves you from the root down to the windows directory then CD SYSTEM32 moves you down one more directory back to where you started.
Now try moving to the root of the drive by yourself. Just type CD\. Then try CD system32_. What happens? Now enter cd windows\system32_.
Computers Are Dumb
This is an example of how dumb computers are. Well if not dumb, litteral, must be told exactly what to do, and definitely not mind readers. The whole purpose of programming and languages is to learn how to tell the computer what you want done in a way that the machine will do what you want. Sometimes it will do even more-sometimes even less. To get the desired result requires debugging and testing. This is NOT because the computer hates you. Its because machines are dumb. I’ve also learned when you think a program is ready to use- find someone [any idiot will do] to try and break it.
In the case of the command not working in our example, while it accepted the command in a mixture of Capitals and small letters, the command prompt expected to be able to find the path — hence we had to tell the program not just where we wanted to go, but how to get there.
Get Glen Sauve’s stories in your inbox
Join Medium for free to get updates from this writer.
Now we’ll make a new directory called BatchFiles. Type MD BatchFiles_. Type CD BatchFiles_. If you type Dir_ you will see you have no files here. Okay Type Exit_. This closes the Command Prompt screen.
Creating a Batch File
Start up your command prompt again by your chosen means. Your back where we started. Type in Notepad StartLearning.bat_. It will tell you that it can’t find it, do you want to create it. Click Yes. You are now in notepad editing a text file called Startleaning.bat. In the Notepad Type “CD C:\BatchFiles”. Click the close window of the notepad. It will ask you is you want to save, click yes. In the command prompt window Check if its there by typing DIR *.bat_ or by typing TYPE startleaning.bat_.in the command window. It should print out what you saved in the Command Prompt window.
Note that I used the Dir command with the wildcard *.bat which is asking for a listing of all bat files in my focused directory. Now try running it by typing StartLearning_ at the Command Prompt. Command prompt should run the StartLearning batch and move you to the BatchFiles directory you created above. Prompt should show you in the BatchFiles directory. The system should tell you if something is wrong.
[Alternatively you can use the Alt-Tab key combination to move between the notepad and command prompt windows.] Your . This is where we’ll be doing the bulk of our learning.
Moving On
We’ve opened and used the Command Prompt, used the HELP, CD, MD, DIR, TYPE commands. Used notepad to create a Batch file to change directories from our start position to a working directory. Run and Debugged the batch file. The next article will explore the commands in more detail and create a Web page of the commands and instructions for quick reference. In the meantime use the HELP [cmd] to read what those commands have to say. If you want to rush ahead on Windows commands refer to the links at the end of the article. There aren’t that many commands and they are quick to learn. It becomes a little more complicated when we add switches, wildcards, and parameters.
Lets start with something simple. In the command window
type DIR C:\Windows\system32_ /pand press enter. You will see a list of files and directories, their sizes, and time and date they were created — a lot of them. The /p at the end of the command is a switch to pause each screen ful. You could leave that out and list the whole directory. Then use the scroll-bar the the right of the screen to look thru the listing.
Notice Directories are marked, and that the files end with .aaa where aaa denotes the file type. For example:
.dll Dynamic Link Library , .xml Application Program Interface,
.exe Executable files [programs], .png Portable Network Graphics just to note a few.
You can use this link
to check out what an extension means. There are over 10,000 file types listed there. Wikipedia is also a source of information. Your computer uses this extension name to know what to do with that file. Take some time and look up a few, e.g. mp3, pdf, .wav. You will run across these many times in your programming. A search of the file extension on the internet can be very informative.
Back to our window. If your Dir is still running waiting for a keypress…just press Ctrl+C to break the run and get back to the prompt.
You should be back to a Command Prompt, which has the directory path in front of it. In my case C:\Batchfiles>. Type Exit_ to quit. Here’s a list of commands I tend to use.
Thanks for following along. I’ll try to get something setup so you can contact me, etc. Till Next time. DOldGeek
References:







