One of the reasons why many Windows users are deathly afraid of using the command prompt in Windows is because they simple don't know what to do when that black screen pops open.
It doesn't look or act like their favorite word document or browser program, and it gives you that "lost in space" feeling.
One way to give yourself a sense of orientation when using the command prompt, is being able to navigate around the file system and into different folders. To do this, you just need to know two simple commands, and, learn how to type less with a simple trick.
First, open up a command prompt by typing cmd in the Search bar on Windows 10, or clicking on Start \Run… and enter cmd in the run box on previous versions of Windows.
Once the command prompt opens, take notice of the current direction location, which is your user directory.
Before you can navigate around, you need to be able to see what's inside the current directory. To view the contents of the directory, simply use the Directory command by typing dir at the prompt and press Enter.
The dir command has many other options that you can use such as, sorting the contents of a directory alphabetically, by size, type, date, etc.
To sort, you need to use the switch /O (followed by how you want to sort) with the dir command. For example:
- To sort by name alphabetically use:Â dir /ON
- To sort by size (smallest first) use: dir /OS
- To sort by date and time (oldest first) use: dir /OD
Tip: To view all available switch options that can be used, type dir /? at the prompt.
Ok, now we can see where were at and the contents of the directory we are currently in. Now let's navigate around.
To move around, we need to use the Change Directory command: cd
So, in your user directory, say you have a folder named Documents. To move into that directory, just type cd Documents at the prompt and press Enter.
At this point you can use the dir command to list the contents of the Document folder. But, say you wanted to keep moving through the directory?
Well. if you know the full path, you can just type it at the prompt (cd C:\Users\wtn\Documents\Updater). But, I stink at typing. So here's a little trick I mentioned at the beginning of the article to make navigating a whole lot easier by typing less.
When you are using the cd command, instead of typing the directory name, press the Tab key on your keyboard. This will list the folders (in the current directory). As you continue to press the Tab key each time, Windows will list one by one, each folder. When you see the folder you want to change directory into, just press Enter.
Now that's a whole lot easier than typing 😉
So far, I showed you how to move "forward" through a directory. But how do you go backwards, or to a different part of the directory? Here are some tips on how to move around:
When you list contents of a directory using the dir command, you will notice the first two items in the list:
09/28/2008Â 05:16 PM .
09/28/2008Â 05:16 PM ..
The item with one period is the current directory and the item with double period is the parent directory (one folder above) of the directory are you in. So to move back or up one folder in the directory tree, type cd .. at the prompt and press enter.
- You can use this command to move back through multiple folders in the directory tree by typing cd ..\.. (this will move you back two parent folders).
- If you just want to start at the top of the directory tree, which in this example is the root of the C:\ drive, just type cd C:\ at the prompt and press Enter.
- If you have more than one drive letter on your computer, you can switch to that drive the same way by typing cd E:\ at the prompt and press Enter.
Now that you can see how easy it is to move around and list directory contents here are some more tricks you can use to impress your friends:
Open an Explorer Window from the Command Prompt's Current Directory
How To Recall Previous Used Commands From The Command Prompt (Win XP)
Comments on How To Navigate Through Folders When Using Windows Command Prompt
Very helpful. Since MS-DOS seems out-dated now, it has been difficult to find relevant information on using the Command Prompt window. Thank you very much.
THIS DOES NOT FUCKING WORK. EXAMPLE — CD H:\ DOES NOT TAKE ME TO THAT ROOT.
@DoesntWork
No need to type " cd " unless you want to go in a "folder". if u want to go in a LOCAL DRIVE, (eg. local drive H), just type " H: ".
no need to type ' cd ' .
Thank you buddy…:-)
it worked…
that sucking cd h:\ didnt work………@BlackOps:
pretty cool. thanks
Hi,
I have installed tomcat in C:\programfiles directory.But when i am navigating to tomcat folder(cd pro*\tom* command in cmd) through command prompt it is showing there is no folder.Any one let me know the reason.
Cheers,
kitty.
So how do you start a file up once you've found it if it has a space in the filename?
For example, I'm using "start" as my command and running .doc, .xls, .zip and other documents, however I can't run a particular file because as I Tab through the different file names it comes up with quotations around it and just opens up a separate cmd window with the name of the file I'm trying to open up in the header.
Help?
thanks a lot…..it was very helpful…:)
Thnaks, nice quick reference 🙂
excellent - just saved me a heap of time 🙂 much appreciated
@DoesntWork:
did you ever find the solution for this
@Chyavan:
did you ever find the solution to change drives ?
I have recorder navagion have GPS how can I get software map
Yeaah! It Work! Thanks! @BlackOps:
Thanks!
@Robert: You can't run (or execute) a data file, you can only execute a program file. Typically a program file will accept as a command line parameter, a data file. For example from within my Documents directory I typed "notepad PUTTY.RND" to open the file PUTTY.RND in notepad. Of course, notepad can't make much sense of the data in PUTTY.RND, but that is another issue.
I wanted to do one of these two
Add Python 3.5 to PATH or
Add Python to environment variables
But the cmd prompt keeps giving me the following message:
'Add' is not recognized as an internal or external command,
operable program or batch file.
Please advise, i am a complete novice in using cmd and I need to be able to use it to run Python from the cmd window ASAP to get on with my project!!
Cheers!!
@BTK:
No need to use the command prompt if you are a novice. Instead use the simple method - in Windows 10, just type environment in the search box, select "Edit the system environment variables" , click the Environment Variables button (System Properties window) and enter your path to Python in System variables section.
Please how can I change directory to compile a program I saved on desktop?
@DoesntWork:
YOU IS SAALLLLLLTY @doesntwork
I am trying to navugate to the quark folder but I cant seem to find it?
@BlackOps:
Thanks Bro it worked