chdir(CMD) 19 June 1992 chdir(CMD) Name chdir (cd) - display name of current directory or change current directory Syntax chdir [drive:][path] chdir[..] cd [drive:][path] cd[..] To display the names of the current drive and directory, use either of the following syntax lines: chdir cd Parameters [drive:][path] Specifies the drive (if other than the current drive) and directory to which you want to change. .. Specifies that you want to change to the parent directory. Notes Changing to the root directory The root directory is the top of the directory hierarchy for a drive. To return to the root directory, type the following command: cd \ Using the current directory from a different drive If you are working in the \USER\JONES directory on drive C and you change to drive D, you can copy files to and from the \USER\JONES directory by specifying only the drive letter C. Changing the directory on another drive You can change the current directory on another drive by specifying the drive name on the command line when you use chdir. Examples Either of the following commands changes your current directory to the directory named PRIMETIM: chdir \primetim cd \primetim Suppose you have a directory named SPECIALS with a subdirectory named SPONSORS. To change your current directory to \SPECIALS\SPONSORS, type the following command: cd \specials\sponsors Or, if your current directory is \SPECIALS, you can use the following command to change to the \SPECIALS\SPONSORS directory: cd sponsors To change from a subdirectory back to the parent directory, type the fol- lowing command: cd .. To display the name of the current directory, you can use chdir or cd without a parameter. For example, if your current directory is \USER\JONES on the disk in drive B, type chdir to see the following response: B:\USER\JONES If you are working on drive D and you want to copy all files in the \USER\JONES and \USER\LEWIS directories on drive C to the root directory on drive D, type the following commands: chdir c:\user\jones copy c:*.* d:\ chdir c:\user\lewis copy c:*.* d:\ If, instead, you want to copy all files in the \USER\JONES and \USER\LEWIS directories to your current location on drive D, type the following commands: chdir c:\user\jones copy c:*.* d: chdir c:\user\lewis copy c:*.* d: