Working directory
In
In operating systems
In most computer file systems, every directory has an entry (usually named ".") which points to the directory itself.
In most
The
COMMAND.COM in
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
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 to return to this directory later on.
The working directory is also displayed by the $PC:\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.[3]
Under DOS, the absolute paths of the working directories of all logical volumes are internally stored in an array-like data structure called the Current Directory Structure (CDS), which gets dynamically allocated at boot time to hold the necessary number of slots for all logical drives (or as defined by
In programming languages
Most
In the
There are similar functions in other languages. For example, in Visual Basic it is usually spelled CHDIR()
.
In Java, the working directory can be obtained through the java.nio.file.Path
interface, or through the java.io.File
class. The working directory cannot be changed.[12]
See also
- Home directory
- Root directory
- Directory
- chroot (Linux systems)
- Load drive(a different, but related concept)
- Long filename (LFN)
Notes
- DX10, used for the TI-990series.
- ^ critical errormessages or delays when trying to retrieve the path of a non-inserted floppy.
References
- ^
- ^ "Microsoft Windows – SetCurrentDirectory function". Microsoft. Archived from the original on 2018-05-27. Retrieved 2017-05-27.
- ^ 4DOS 8.00 online help.
- Caldera, Inc. 1998-12-24. Archivedfrom the original on 2019-04-08. Retrieved 2019-04-08.
- Concurrent Controls, Inc.(CCI). 1997-02-10. HELP.HLP.
- Caldera, Inc. 1998 [1993, 1997]. Archived from the originalon 2016-11-04. Retrieved 2013-08-10.
- ^
- ^ a b c d Paul, Matthias R. (1997-07-30) [1994-05-01]. NWDOS-TIPs — Tips & Tricks rund um Novell DOS 7, mit Blick auf undokumentierte Details, Bugs und Workarounds. MPDOSTIP (in German) (3 ed.). Archived from the original on 2017-09-10. Retrieved 2014-08-06. (NB. NWDOSTIP.TXT is a comprehensive work on Novell DOS 7 and OpenDOS 7.01, including the description of many undocumented features and internals. It is part of the author's yet larger
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 theNWDOSTIP.TXT
file.) [3] - INTER61.
- ^ a b c Paul, Matthias R. (1997-06-07) [April 1994]. "Chapter 1.3.xi: Überlange Pfade". NWDOS7UN.TXT — Zusammenfassung der dokumentierten und undokumentierten Fähigkeiten von Novell DOS 7. MPDOSTIP (in German). Archived from the original on 2016-11-07. Retrieved 2016-11-07.
- IEEE and The Open Group. 2004 [2001]. Archivedfrom the original on 2018-02-09. Retrieved 2018-05-27.
- ^ "JDK-4045688: Add chdir or equivalent notion of changing working directory". Bug Database. Oracle (Sun Microsystems). 2008-08-18 [1997-04-17]. Archived from the original on 2017-10-19. Retrieved 2011-02-20.
Further reading
- Chen, Raymond (2010-10-11). "Why does each drive have its own current directory?". The New Old Thing. Microsoft. Archivedfrom the original on 2016-04-12. Retrieved 2017-05-27.
- Chen, Raymond (2010-05-06). "What are these strange =C: environment variables?". The New Old Thing. Microsoft. Archivedfrom the original on 2018-05-27. Retrieved 2017-05-27.
External links
- Working Directory (wd) at Github – a software package that tracks commonly used directories in a bash session