Utilizing Absolute and Relative Paths
Absolute Path
An absolute path begins with the basis listing and specifies the precise location of the folder. To open a folder utilizing an absolute path, comply with these steps:
- In a brand new command immediate window, sort “cd” adopted by an area.
- Enter absolutely the path of the folder you wish to open and press Enter.
For instance, to open the “My Paperwork” folder within the “Paperwork and Settings” listing, you’d sort the next command:
“`
cd C:Paperwork and SettingsYOUR_USER_NAMEMy Paperwork
“`
Relative Path
A relative path begins from the present listing and specifies the situation of the folder relative to it. To open a folder utilizing a relative path, comply with these steps:
- In a brand new command immediate window, sort “cd” adopted by an area.
- Enter the relative path of the folder you wish to open and press Enter.
For instance, in case you are within the “Paperwork” listing and wish to open the “My Paperwork” folder, you’d sort the next command:
“`
cd My Paperwork
“`
You may as well use the next desk that can assist you perceive the distinction between absolute and relative paths:
Path Kind |
Instance |
Description |
Absolute |
C:Paperwork and SettingsYOUR_USER_NAMEMy Paperwork |
Specifies the precise location of the folder from the basis listing |
Relative |
My Paperwork |
Specifies the situation of the folder relative to the present listing |
Utilizing the “| extra” Command for Paging By Outcomes
Whenever you execute a command that produces a considerable amount of output, the outcomes might scroll off the display too rapidly so that you can learn them. To stop this, you should utilize the “| extra” command to paginate the outcomes. The “| extra” command will pause the output after every screenful of information, and you may press the Enter key to proceed scrolling via the outcomes.
For instance, the next command will checklist the contents of the listing “C:WindowsSystem32” and pause after every screenful of outcomes:
dir C:WindowsSystem32 | extra
You may as well use the “| extra” command to create a customized pager. For instance, the next command will create a pager that pauses after each 10 traces of output:
dir C:WindowsSystem32 | extra /10
You may as well use the “| extra” command to specify the dimensions of the window during which the output is displayed. For instance, the next command will create a pager that shows 20 traces of output at a time:
dir C:WindowsSystem32 | extra /20
The next desk summarizes the choices that you should utilize with the “| extra” command:
Choice |
Description |
/10 |
Pauses after each 10 traces of output |
/20 |
Pauses after each 20 traces of output |
/np |
Disables pausing and scrolls constantly |
/s |
Shows the output in a single screenful |
/t |
Shows the output in a desk format |
Opening a Folder Utilizing the “dir” Command
This command lists the contents of a specified folder or listing. It may be used within the following format:
“`
dir [path]
“`
The place:
`path` is the complete path to the folder you wish to open.
For instance, to open the “My Paperwork” folder, you’d use the next command:
“`
dir C:UsersyourusernameDocuments
“`
Utilizing the /w Change
The `/w` change specifies that the contents of the folder must be displayed in a large format. This makes it simpler to learn the file names and sizes.
The next command would open the “My Paperwork” folder in a large format:
“`
dir C:UsersyourusernameDocuments /w
“`
Utilizing the /s Change
The `/s` change specifies that the contents of the folder and all its subfolders must be displayed.
The next command would open the “My Paperwork” folder and all its subfolders:
“`
dir C:UsersyourusernameDocuments /s
“`
Utilizing the /a Change
The `/a` change specifies that the attributes of the information and folders within the listing must be displayed.
The next command would open the “My Paperwork” folder and show the attributes of the information and folders:
“`
dir C:UsersyourusernameDocuments /a
“`
Utilizing the /r Change
The `/r` change specifies that the subdirectories must be sorted in reverse order.
The next command would open the “My Paperwork” folder and kind the subdirectories in reverse order:
“`
dir C:UsersyourusernameDocuments /r
“`
Utilizing the /b Change
The `/b` change specifies that solely the file names must be displayed, with out another info.
The next command would open the “My Paperwork” folder and show solely the file names:
“`
dir C:UsersyourusernameDocuments /b
“`
Opening a Folder Utilizing the “Explorer” Command
The explorer command in cmd is used to open a specified folder in Home windows File Explorer. To make use of this command, comply with these steps:
1. Open Command Immediate
Press the Home windows key + R to open the Run dialog field. Kind “cmd” and press Enter to open Command Immediate.
2. Navigate to the Desired Folder
Use the cd command to navigate to the folder you wish to open. For instance, to navigate to the Desktop folder, sort the next command:
cd %userprofilepercentDesktop
3. Use the “Explorer” Command
Kind the next command to open the present folder in Home windows File Explorer:
explorer .
4. Open a Particular Folder
To open a particular folder, specify the complete path to the folder after the explorer command. For instance, to open the Paperwork folder, sort the next command:
explorer %userprofilepercentDocuments
5. Open A number of Folders
To open a number of folders without delay, separate the folder paths with areas. For instance, to open the Paperwork and Photos folders, sort the next command:
explorer %userprofilepercentDocuments %userprofilepercentPhotos
6. Open a Hidden Folder
To open a hidden folder, use the /root parameter with the explorer command. For instance, to open the AppData folder, sort the next command:
explorer /root %userprofilepercentAppData
7. Superior Choices
The explorer command provides a number of superior choices that can be utilized to customise the habits of the opened folder. These choices embrace:
Choice |
Description |
/n |
Opens the folder in a brand new window |
/e |
Selects all information and folders within the opened folder |
/choose |
Selects the desired file or folder within the opened folder |
Opening a Folder Utilizing the “%cd%” Variable
The “%cd%” variable in Command Immediate represents the present working listing. By using this variable, you possibly can effortlessly open the present folder in File Explorer or another file administration program.
Steps
-
Navigate to the Goal Folder: Use the "cd" command to navigate to the folder you want to open. For example, if the folder is positioned in "C:UsersJohnDocumentsFolder", enter "cd C:UsersJohnDocumentsFolder".
-
Show the Present Listing: Kind "%cd%" in Command Immediate. This command will show the complete path of the present working listing.
-
Copy the Path: Proper-click throughout the "%cd%" output and choose "Copy". This can copy the folder’s path to the clipboard.
-
Open File Explorer: Press "Home windows Key + E" to open File Explorer.
-
Paste the Path into the Tackle Bar: Click on on the tackle bar on the prime of File Explorer and press "Ctrl + V" to stick the copied path.
-
Press Enter: As soon as the trail is pasted, press "Enter". This can navigate File Explorer to the specified folder.
-
Open with an Alternate Program: In case you want to open the folder with a distinct file administration program, resembling Complete Commander, use the next syntax:
begin "" "C:PathtoTotalCommander.exe" "%cd%"
- Create a Shortcut: To create a shortcut that opens the present folder in File Explorer, navigate to the folder and enter the next command:
mklink "Shortcut Identify" "%cd%"
- Customise Shortcut Properties: Proper-click the shortcut and choose "Properties". Within the "Goal" subject, modify "explorer.exe" to the trail of your most popular file administration program. Moreover, you possibly can change the "Begin in" subject to the particular folder throughout the present working listing that you simply want to open.
Command |
Description |
%cd% |
Shows the present working listing |
begin “” “C:PathtoTotalCommander.exe” “%cd%” |
Opens the present folder in Complete Commander |
mklink “Shortcut Identify” “%cd%” |
Creates a shortcut that opens the present folder in File Explorer |
Opening a Folder Utilizing the “subst” Command
The “subst” command is a robust instrument that permits customers to create digital drives and assign them to bodily folders on their pc. This may be helpful for accessing information and folders extra simply or for mapping community drives to native folders. To open a folder utilizing the “subst” command, comply with these steps:
- Open the Command Immediate. You are able to do this by urgent Home windows Key + R and typing “cmd”.
- Kind the next command, changing “X:” with the drive letter you wish to assign to the folder:
subst X: [path to folder]
For instance, to assign the drive letter “X:” to the folder “C:UsersJohn DoeDocuments”, you’d sort:
subst X: C:UsersJohn DoeDocuments
- Press Enter.
Now you can entry the folder utilizing the assigned drive letter. For instance, in case you assigned the drive letter “X:” to the folder “C:UsersJohn DoeDocuments”, now you can entry the folder by typing “X:” within the Command Immediate or within the File Explorer tackle bar.
To take away the digital drive, merely sort the next command:
subst X: /D
the place “X:” is the drive letter you wish to take away.
How one can Open a Folder in CMD
The command immediate (CMD) is a robust instrument that can be utilized to carry out quite a lot of duties on a pc. One of the crucial frequent duties is to open a folder. There are a number of methods to do that, however the commonest is to make use of the “cd” command.
To open a folder utilizing the “cd” command, merely sort the next command into the command immediate:
“`
cd path_to_folder
“`
For instance, to open the folder “My Paperwork”, you’d sort the next command:
“`
cd C:UsersYourUsernameDocuments
“`
After getting opened the folder, you should utilize the “dir” command to view the contents of the folder.
Individuals Additionally Ask
How do I open a folder in CMD utilizing a shortcut?
You possibly can create a shortcut to a folder in CMD through the use of the “mklink” command. To do that, merely sort the next command into the command immediate:
“`
mklink /d shortcut_name path_to_folder
“`
For instance, to create a shortcut to the folder “My Paperwork” on the desktop, you’d sort the next command:
“`
mklink /d desktop_shortcut C:UsersYourUsernameDocuments
“`
How do I open a folder in CMD utilizing a batch file?
You possibly can create a batch file that may open a folder in CMD. To do that, merely create a brand new textual content file and kind the next command into it:
“`
cd path_to_folder
“`
For instance, to create a batch file that may open the folder “My Paperwork”, you’d sort the next command into the textual content file:
“`
cd C:UsersYourUsernameDocuments
“`
After getting saved the batch file, you possibly can double-click on it to open the folder in CMD.