Chdir (Cd) Displays the name of the current directory, or changes the current folder _dos/bat

Source: Internet
Author: User
Tags parent directory
Chdir (CD)
Displays the name of the current directory, or changes the current folder. When used with only one drive letter (for example, ChDir C:), ChDir displays the current drive name and folder. Used without parameters, ChDir displays the current drive and directory.

Grammar
ChDir [[D] [Drive:][path] [...]] [[/d] [Drive:][path] [...]]

CD [[/d] [Drive:][path] [...]] [[/d] [Drive:][path] [...]]

Parameters
/d
Changes the current directory of the current drive or drive.
[Drive:] [Path]
Specifies the drive to change to (if not the current drive) and the directory.
[..]
Indicates that you want to change to the parent folder.
/?
Display Help at the command prompt.
Comments
Using Command Extensions
If you enable command extensions (that is, by default), the current directory path matches the folder names exactly as they appear on your hard disk using the same uppercase or lowercase folder name format. For example, if the folder on your hard disk is named C:\Temp, the CD C:\TEMP sets the current directory to C:\Temp and matches the folder name format for that folder on your hard disk.

To disable a command extension for a particular procedure, type:

CMD E:off

When you disable command extensions, CHDIR does not treat spaces as delimiters. This way, you can change to a subdirectory name that contains spaces without placing [Path] in quotation marks. For example, the following path can be changed to the \start Menu subdirectory:

CD \winnt\profiles\username\programs\start Menu

For more information about enabling and disabling command extensions, see cmd in.

Change to root directory
The root directory is the top level of the directory tree structure of the drive. To return to the root directory, type:

cd\

Change the default directory on a drive from another drive
To change the default directory on a drive from your drive, type one of the following commands:

ChDir [Drive:\[directory]]

CD [Drive:\[directory]]

To verify the changes made to the directory, type one of the following commands:

chdir [Drive:]

CD [Drive:]

The chdir command with different parameters is provided in the Recovery Console.
Example
If it is used with a drive letter, ChDir displays the current directory for that drive. For example, when you type cd C: At the C:\Temp directory prompt, the following information is displayed:

C:\Temp

To change the current directory to a directory named Reports, you can type one of the following commands:

ChDir \reports

CD \reports

To change the current directory to a \specials\sponsors subdirectory, you can type:

CD \specials\sponsors

Alternatively, if your current directory is \specials, you can type the following command to change to the \specials\sponsors subdirectory:

CD Sponsor

To change from a subdirectory to its parent directory, type:

Cd..

To display the name of the current directory, you can use the ChDir or CD command with no parameters. For example, if the current directory is \public\jones on the B drive, type ChDir will appear as follows:

B:\Public\Jones

To work on the D drive and want to copy all files in the \Public\Jones and \public\lewis directories in C disk to the root of D disk, enter:

ChDir C:\public\jones

Copy c:*.* D:\

ChDir C:\public\lewis

Copy c:*.* D:\

If you want to copy all files under the \Public\Jones and \public\lewis directory to the current location on drive D, type:

ChDir C:\public\jones

Copy c:*.* D:

ChDir C:\public\lewis

Copy c:*.* D:

XOX

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.