How to navigate directories using the command line

Author: Sara Rhodes
Date Of Creation: 13 February 2021
Update Date: 1 July 2024
Anonim
Directories and Navigation (Command Line)
Video: Directories and Navigation (Command Line)

Content

This article explains how to change to a different folder (directory) in the Windows command prompt. To work with the command line, you must use an administrator account.

Steps

Part 1 of 2: How to open a command prompt

  1. 1 Open the start menu. To do this, click on the Windows logo in the lower left corner of the screen or press the key ⊞ Win on keyboard.
    • In Windows 8, move your mouse to the upper-right corner of the screen and click the magnifying glass that appears.
  2. 2 In the search bar, enter command line. The command line utility icon appears above the search bar.
  3. 3 Right click on the command line icon. It looks like a black square. A context menu will open.
  4. 4 Click Run as administrator. This option is at the top of the drop-down menu. A command prompt will open with administrator rights.
    • In the window that opens with a proposal to confirm your actions, click "Yes".
    • You cannot run Command Prompt as an administrator if you are using a restricted computer, located in a public place or connected to a local network (for example, in a library or at a school), that is, if you are using a guest account recording.

Part 2 of 2: How to change directory

  1. 1 Enter cd . Be sure to add a space after "cd". This command, which is short for "change directory", is the main command for changing directory.
    • Don't press the key ↵ Enter.
  2. 2 Determine the path to the desired directory. The directory path is like a directory listing. For example, if the directory you want is the System32 folder located in the WINDOWS folder on the system drive, the path will be C: WINDOWS System32 .
    • To find out the path to a folder, open My Computer, double-click on the hard drive icon, navigate to the desired folder, and then copy the information from the address bar of Explorer (above).
  3. 3 Enter the path to the directory. Do this after the "cd" command. Make sure there is a space between "cd" and the directory path.
    • For example, the command might look like this: cd Windows System32 or cd D:.
    • By default, all folders are located on the hard drive (for example, "C:"), so you do not need to enter a hard drive letter.
  4. 4 Click on ↵ Enter. This will take you to the correct directory.

Tips

  • You need to change the directory to edit or delete the file.
  • Some common commands for working with directories are as follows:
    • D: or F: - change the directory to a floppy drive or a connected flash drive.
    • .. - move up one folder from the current directory (for example, from "C: Windows System32" to "C: Windows").
    • / d - change drive and directory at the same time. For example, if you are in the root directory of the "D:" drive at the command prompt, enter "cd / d C: Windows" to navigate to the "Windows" folder on the "C:" drive.
    • - go to the root directory (for example, the system drive).

Warnings

  • Attempting to run a command associated with a specific file or folder from a different directory will result in an error.