Term of the Moment

blockchain oracle


Look Up Another Term


Definition: cmd folders


This follow-up to "cmd abc's" shows you how to switch between folders on the DOS/Windows command line. In "cmd abc's," you learned that a file/folder hierarchy looks like an organization chart such as the following. See cmd abc's.





The Basics
The command prompt displays the "default folder." When a command is executed, all files referenced are assumed to be in the default folder. If a file is in a different folder, the command must include the folder name with the file name. In the following example, the command prompt is currently set to the AA folder, and the first command references AA by default. Without changing the command prompt, the second command uses an explicit reference to the BB folder (the \bb\):

 1 - Implicit Reference to AA Folder

   C:\AA>dir *.gif       all GIFs in AA

 2 - Explicit Reference to BB Folder

   C:\AA>dir \bb\*.gif   all GIFs in BB



Creating a Folder
Folders can be created off the root or within other folders any number of layers below. These are technically "subfolders" or "subdirectories," but the term "folder" is commonly used to refer to a folder at any level.

The only tricky part to remember is that there is different syntax if you want to go back "up the tree" or "down the tree."

Down the Tree
This example creates a JANINE folder within the default ABC folder. When switching to JANINE, there is no backslash in the syntax (this is important):
  C:\ABC>md janine   create JANINE folder
  C:\ABC>cd janine   go to JANINE folder
  C:\>ABC\JANINE>    prompt changes


Up the Tree
To go to a folder at the same or higher level, the backslash is used. This example creates a JANINE folder inside the XYZ folder, which is at the same level as the default ABC folder:
        C:\ABC>md \xyz\janine



Another Example
Suppose therea are three folders in the PLANS folder:
           C:\PLANS\2010
           C:\PLANS\2011
           C:\PLANS\2012

If the default is 2010, and you want to go to 2012, there are two ways to do it:
  C:\PLANS\2010>cd \plans\2012
  C:\PLANS\2012>

   or

  C:\PLANS\2010>cd ..   (..) up one level
  C:\PLANS>cd 2012      go to 2012**
  C:\PLANS\2012>


Remember...
No backslash (\) when you go down the tree.


Switching Drives
When switching between folders on different drives, switch drives first. For example, to switch from C:\PLANS\2010> to D:\BUDGETS>, type:
  C:\PLANS\1991>d:   switch drives
  D:\>cd budgets     switch folders
  D:\>cd bud*        (*) a shortcut
  D:\BUDGETS>        prompt changes



Folder Rules
There are three important rules to remember when dealing with folders.

Folder Rule #1
When going to a folder on a different drive, change drives first, then change folders.

Folder Rule #2
The backslash represents the root folder. It is also used as a separator symbol between folder and file names.

Folder Rule #3
When using the CD command to go to a folder on the same or previous level, the path name must begin with the root (\).