In computing, the working directory is the directory of a file system to which a relative path is relative.
In a command-line environment, a user often uses files in or relative to the working directory. The system state that identifies the working directory provides a convenient way to define the context of work. Users can use paths that are conceptually simpler and usually shorter, instead of always using absolute paths. For example, for working directory /home/user/data on a Unix-like system, the file name foo.txt (a relative path) refers to absolute path /home/user/data/foo.txt. System state for working directory often also applies in a graphical user interface (GUI), but often is not useful since the GUI environment maintains directory context in a different way.
As a feature, working directories vary by environment yet have some common, typical attributes. Typically, each process has a separate working directory, which allows users to have a different working directory for each shell running on the operating system. Although common in systems that provide a hierarchical file system, the working directory feature is not required; for example, the DX10 operating system does not provide it, as all pathnames are either absolute or relative to the system volume.
Alternate names include current working directory (CWD) and just current directory.
cd command for setting the working directory. Some systems provide a command with a different name. For example, chdir is an alternate name for cd in DOS/Windows.pwd (short for print working directory) that reports the absolute path to the working directory. The equivalent command in DOS/Windows is cd without arguments. Using cd without arguments in Unix-like systems generally sets the working directory to the user's home directory.prompt command. To keep the prompt short in a deep directory, the DR-DOS 7.07 COMMAND.COM supports a $W token to display only the deepest subdirectory level. So, where a default PROMPT $P$G would result f.e. in C:\DOS> or C:\DOS\DRDOS>, a PROMPT $N:$W$G would instead yield C:DOS> and C:DRDOS>, respectively. A similar facility (using $W and $w) was added to 4DOS as well.chdir() (accessible via C and the many languages that interoperate with it) is a system call that changes the working directory. Its argument is a text string that is a path to the target directory, either absolute or relative to the existing value.java.nio.file.Path interface, or the java.io.File class. The working directory cannot be changed.COMMAND.COM in DR-DOS 7.02 and higher provides ECHOS, a variant of the ECHO command that omits the terminating linefeed. This can be used to create a temporary batchjob storing the working directory in an environment variable like CD for later use. For example:
ECHOS SET CD=> SETCD.BAT CHDIR >> SETCD.BAT CALL SETCD.BAT DEL SETCD.BAT
Alternatively, under Multiuser DOS and DR-DOS 7.02 and higher, various internal and external commands support a parameter /B (for "Batch"). This modifies the output of commands to become suitable for direct command-line input (when redirecting it into a batch file) or usage as a parameter for other commands (using it as input for another command). Where CHDIR would issue a directory path like C:\DOS, a command like CHDIR /B would issue CHDIR C:\DOS instead, so that CHDIR /B > RETDIR.BAT would create a temporary batchjob allowing returning to this directory later on.
MPDOSTIP.ZIP collection maintained up to 2001 and distributed on many sites at the time. The provided link points to a HTML-converted older version of the NWDOSTIP.TXT file.)