Purpose: | Display or change the current directory |
Format: | CD [/D /N /R /X] [path | - | :path] |
path | The directory to change to, optionally including a drive letter |
folder | A Windows Shell folder name |
See also: CDD, MD, PUSHD, and RD.
Internet: Can be used with FTP Servers.
Usage:
CD and CHDIR are synonyms. You can use either one.
CD lets you navigate through a drive's subdirectory structure by changing the current working directory. If you enter CD and a directory name, the named directory becomes the new current directory. For example, to change to the subdirectory C:\FINANCE\MYFILES:
[c:\] cd \finance\myfiles
[c:\finance\myfiles]
Every disk drive on the system has its own current directory. Specifying both a drive and a directory in the CD command will change the current directory on the specified drive, but will not change the default drive (unless you use the /D option). For example, to change the default directory on drive A:
[c:\] cd a:\utility
[c:\]
Notice that this command does not change to drive A:. Use the /D option, or preferably the CDD command to change the current drive and directory at the same time.
If path contains white space or special characters (which is valid only for an LFN drive), you must enclose it in double quotes.
If path begins with a ~ (tilde), CD will substitute to the user's home directory, as defined by HOME in the environment. (If HOME doesn't exist, TCC-RT will look for %HOMEDRIVE + HOMEPATH.)
You can change to the parent directory with CD ..; you can also go up one additional directory level with each additional .. For example, CD .... will go up three levels in the directory tree (see Extended Parent Directory Names). You can move to a sibling directory (one that branches from the same parent directory as the current subdirectory) with a command like CD ..\newdir .
If you enter CD with no parameter or with only a disk drive name, it will display the current directory on the default or named drive.
If CD cannot change to the directory you have specified it will attempt to search the CDPATH in order to find a matching directory and switch to it. You can disable this default extended search with /N. You can also use wildcards in path to force an extended directory search.
If the EverythingSearch option is set, CD will use Everything Search (http://www.voidtools.com) instead of JPSTREE.IDX for fuzzy directory searches. Everything Search is faster, but will only work on local NTFS drives. Setting EverythingSearch is the equivalent of setting FuzzyCD=3 (*name*). The Take Command installer will install Everything Search automatically.
CD saves the current directory before changing to a new directory. You can switch back to the previous directory by entering CD -. (There must be a space between the CD command and the hyphen.) You can switch back and forth between two directories by repeatedly entering CD -. The saved directory is the same for both the CD and CDD commands. Drive changes and automatic directory changes also modify the saved directory, so you can use CD - to return to a directory that you exited with an automatic directory change. TCC-RT recognizes a single hyphen on the command line as an internal alias for CDD -.
You can also use CD to display or change the current directory on an FTP server opened with IFTP. For example:
cd ftp:
ftp://ftp.microsoft.com/
cd ftp:/pub
CD never changes the default drive, unless the /D option is specified. If you change directories on one drive, switch to another drive, and then enter CD -, the directory will be restored on the first drive but the current drive will not be changed.
At startup, TCC-RT saves the last directory from SHRALIAS or (if loaded by TCSTART) the directory history list to the "CD -" buffer.
You can also CD to one of the predefined Windows folders. The syntax is:
CDD :foldername
where foldername can be:
AccountPictures
AddNewProgramsFolder
AdministrativeTools
AppData
ApplicationShortcuts
AppsFolder
AppUpdatesFolder
Cache
CameraRoll
CDBurning
ChangeRemoveProgramsFolder
CommonAdminTools
CommonAppData
CommonDesktop
CommonDocuments
CommonDownloads
CommonMusic
CommonPictures
CommonPrograms
CommonRingtones
CommonStartMenu
CommonStartup
CommonTemplates
CommonVideo
ConflictFolder
ConnectionsFolder
Contacts
ControlPanelFolder
Cookies
Cookies\Low
CredentialManager
CryptoKeys
Desktop
DeviceMetadataStore
DocumentsLibrary
Downloads
dpapiKeys
Favorites
Fonts
Games
GameTasks
History
HomeGroupCurrentUserFolder
HomeGroupFolder
ImplicitAppShortcuts
InternetFolder
Libraries
Links
LocalAppData
LocalAppDataLow
MusicLibrary
MyComputerFolder
MyMusic
MyPictures
MyVideo
Nethood
NetworkPlacesFolder
OneDrive
OneDriveCameraRoll
OneDriveDocuments
OneDriveMusic
OneDrivePictures
Personal
PicturesLibrary
PrintersFolder
PrintHood
Profile
ProgramFiles
ProgramFilesCommon
ProgramFilesCommonX64
ProgramFilesCommonX86
ProgramFilesX64
ProgramFilesX86
Programs
Public
PublicAccountPictures
PublicGameTasks
PublicLibraries
QuickLaunch
Recent
RecordedTVLibrary
RecycleBinrFolder
ResourceDir
RingTones
RoamedTileImages
RoamingTiles
SavedGames
Screenshots
Searches
SearchHistoryFolder
SearchHomeFolder
SearchTemplatesFolder
SendTo
StartMenuStart Menu
Startup
SyncCenterFolder
SyncResultsFolder
SyncSetupFolder
System
SystemCertificates
SystemX86
Templates
ThisPCDesktopFolder
UsersFilesFolder
UserPinned
UserProfiles
UserProgramFiles
UserProgramFilesCommon
UsersLibrariesFolder
VideosLibrary
Windows
Options:
/D | Changes the current drive as well as directory. This option is included only for compatibility with the same option available in some versions of CMD. In most cases you should use CDD, which performs the same function. |
/N | Skips the standard extended directory search when the directory is not found. This option is useful in batch files to force an error (rather than an extended search) if a directory is not found. |