<s>
In	O
computing	O
,	O
the	O
working	O
directory	B-Application
of	O
a	O
process	B-Operating_System
is	O
a	O
directory	B-Application
of	O
a	O
hierarchical	B-Application
file	I-Application
system	I-Application
,	O
if	O
any	O
,	O
dynamically	O
associated	O
with	O
each	O
process	B-Operating_System
.	O
</s>
<s>
It	O
is	O
sometimes	O
called	O
the	O
current	O
working	O
directory	B-Application
(	O
CWD	B-Application
)	O
,	O
e.g.	O
</s>
<s>
the	O
BSD	B-Operating_System
getcwd	O
function	O
,	O
or	O
just	O
current	O
directory	B-Application
.	O
</s>
<s>
When	O
the	O
process	B-Operating_System
refers	O
to	O
a	O
file	O
using	O
a	O
simple	O
file	O
name	O
or	O
relative	O
path	B-Application
(	O
as	O
opposed	O
to	O
a	O
file	O
designated	O
by	O
a	O
full	B-Application
path	I-Application
from	O
a	O
root	B-Application
directory	I-Application
)	O
,	O
the	O
reference	O
is	O
interpreted	O
relative	O
to	O
the	O
working	O
directory	B-Application
of	O
the	O
process	B-Operating_System
.	O
</s>
<s>
So	O
for	O
example	O
a	O
process	B-Operating_System
with	O
working	O
directory	B-Application
/rabbit	O
-shoes	O
that	O
asks	O
to	O
create	O
the	O
file	O
foo.txt	O
will	O
end	O
up	O
creating	O
the	O
file	O
/rabbit-shoes/foo.txt	O
.	O
</s>
<s>
which	O
points	O
to	O
the	O
directory	B-Application
itself	O
.	O
</s>
<s>
In	O
most	O
DOS	B-Device
and	O
UNIX	B-Application
command	B-Application
shells	O
,	O
as	O
well	O
as	O
in	O
the	O
Microsoft	B-Application
Windows	I-Application
command	B-Application
line	I-Application
interpreters	O
cmd.exe	B-Device
and	O
Windows	B-Application
PowerShell	I-Application
,	O
the	O
working	O
directory	B-Application
can	O
be	O
changed	O
by	O
using	O
the	O
CD	B-Application
or	O
CHDIR	B-Application
commands	O
.	O
</s>
<s>
In	O
Unix	B-Application
shells	I-Application
,	O
the	O
pwd	B-Protocol
command	B-Application
outputs	O
a	O
full	O
pathname	B-Application
of	O
the	O
working	O
directory	B-Application
;	O
the	O
equivalent	O
command	B-Application
in	O
DOS	B-Device
and	O
Windows	O
is	O
CD	B-Application
or	O
CHDIR	B-Application
without	O
arguments	O
(	O
whereas	O
in	O
Unix	B-Application
,	O
cd	B-Application
used	O
without	O
arguments	O
takes	O
the	O
user	O
back	O
to	O
his/her	O
home	B-Application
directory	I-Application
)	O
.	O
</s>
<s>
The	O
environment	O
variable	O
PWD	B-Protocol
(	O
in	O
Unix/Linux	O
shells	O
)	O
,	O
or	O
the	O
pseudo-environment	O
variables	O
CD	B-Application
(	O
in	O
Windows	O
COMMAND.COM	B-Operating_System
and	O
cmd.exe	B-Device
,	O
but	O
not	O
in	O
OS/2	O
and	O
DOS	B-Device
)	O
,	O
or	O
_CWD	O
,	O
_CWDS	O
,	O
_CWP	O
and	O
_CWPS	O
(	O
under	O
4DOS	B-Application
,	O
4OS2	B-Application
,	O
4NT	B-Application
etc	O
.	O
)	O
</s>
<s>
Microsoft	B-Application
Windows	I-Application
file	O
shortcuts	O
have	O
the	O
ability	O
to	O
store	O
the	O
working	O
directory	B-Application
.	O
</s>
<s>
COMMAND.COM	B-Operating_System
in	O
DR-DOS	B-Application
7.02	O
and	O
higher	O
provides	O
ECHOS	O
,	O
a	O
variant	O
of	O
the	O
ECHO	B-Application
command	I-Application
omitting	O
the	O
terminating	O
linefeed	O
.	O
</s>
<s>
This	O
can	O
be	O
used	O
to	O
create	O
a	O
temporary	O
batchjob	O
storing	O
the	O
working	O
directory	B-Application
in	O
an	O
environment	O
variable	O
like	O
CD	B-Application
for	O
later	O
use	O
,	O
for	O
example	O
:	O
</s>
<s>
Alternatively	O
,	O
under	O
Multiuser	B-Operating_System
DOS	I-Operating_System
and	O
DR-DOS	B-Application
7.02	O
and	O
higher	O
,	O
various	O
internal	O
and	O
external	O
commands	O
support	O
a	O
parameter	O
/B	O
(	O
for	O
"	O
Batch	O
"	O
)	O
.	O
</s>
<s>
This	O
modifies	O
the	O
output	O
of	O
commands	O
to	O
become	O
suitable	O
for	O
direct	O
command	B-Application
line	I-Application
input	O
(	O
when	O
redirecting	O
it	O
into	O
a	O
batch	O
file	O
)	O
or	O
usage	O
as	O
a	O
parameter	O
for	O
other	O
commands	O
(	O
using	O
it	O
as	O
input	O
for	O
another	O
command	B-Application
)	O
.	O
</s>
<s>
Where	O
CHDIR	B-Application
would	O
issue	O
a	O
directory	B-Application
path	I-Application
like	O
C:\DOS,	O
a	O
command	B-Application
like	O
CHDIR	B-Application
/B	O
would	O
issue	O
CHDIR	B-Application
C:\DOS	O
instead	O
,	O
so	O
that	O
CHDIR	B-Application
/B	O
>	O
RETDIR.BAT	O
would	O
create	O
a	O
temporary	O
batchjob	O
allowing	O
to	O
return	O
to	O
this	O
directory	B-Application
later	O
on	O
.	O
</s>
<s>
The	O
working	O
directory	B-Application
is	O
also	O
displayed	O
by	O
the	O
$P	O
token	O
of	O
the	O
PROMPT	O
command	B-Application
To	O
keep	O
the	O
prompt	O
short	O
even	O
inside	O
of	O
deep	O
subdirectory	B-Application
structures	O
,	O
the	O
DR-DOS	B-Application
7.07	O
COMMAND.COM	B-Operating_System
supports	O
a	O
$W	O
token	O
to	O
display	O
only	O
the	O
deepest	O
subdirectory	B-Application
level	O
.	O
</s>
<s>
in	O
C:\DOS>	O
or	O
C:\DOS\DRDOS>,	O
a	O
PROMPT	O
$	O
N	O
:	O
$W$G	O
would	O
instead	O
yield	O
C:DOS>	O
and	O
C:DRDOS>	O
,	O
respectively	O
.	O
</s>
<s>
A	O
similar	O
facility	O
(	O
using	O
$W	O
and	O
$w	O
)	O
was	O
added	O
to	O
4DOS	B-Application
as	O
well	O
.	O
</s>
<s>
Under	O
DOS	B-Device
,	O
the	O
absolute	B-Application
paths	I-Application
of	O
the	O
working	O
directories	B-Application
of	O
all	O
logical	O
volumes	O
are	O
internally	O
stored	O
in	O
an	O
array-like	O
data	O
structure	O
called	O
the	O
Current	O
Directory	B-Application
Structure	O
(	O
CDS	B-Application
)	O
,	O
which	O
gets	O
dynamically	O
allocated	O
at	O
boot	O
time	O
to	O
hold	O
the	O
necessary	O
number	O
of	O
slots	O
for	O
all	O
logical	O
drives	O
(	O
or	O
as	O
defined	O
by	O
LASTDRIVE	B-Device
)	O
.	O
</s>
<s>
This	O
structure	O
imposes	O
a	O
length-limit	O
of	O
66	O
characters	O
on	O
the	O
full	B-Application
path	I-Application
of	O
each	O
working	O
directory	B-Application
,	O
and	O
thus	O
implicitly	O
also	O
limits	O
the	O
maximum	O
possible	O
depth	O
of	O
subdirectories	B-Application
.	O
</s>
<s>
DOS	B-Operating_System
Plus	I-Operating_System
and	O
older	O
issues	O
of	O
DRDOS	B-Application
(	O
up	O
to	O
DR	O
DOS	B-Device
6.0	O
,	O
with	O
BDOS	B-Operating_System
6.7	O
in	O
1991	O
)	O
had	O
no	O
such	O
limitation	O
due	O
to	O
their	O
implementation	O
using	O
a	O
DOS	B-Device
emulation	O
on	O
top	O
of	O
a	O
Concurrent	B-Operating_System
DOS	I-Operating_System
-	O
(	O
and	O
thus	O
CP/M	B-Operating_System
-86	I-Operating_System
-	O
)	O
derived	O
kernel	O
,	O
which	O
internally	O
organized	O
subdirectories	B-Application
as	O
relative	O
links	O
to	O
parent	B-Application
directories	I-Application
instead	O
of	O
as	O
absolute	B-Application
paths	I-Application
.	O
</s>
<s>
Since	O
PalmDOS	B-Operating_System
(	O
with	O
BDOS	B-Operating_System
7.0	O
)	O
and	O
DRDOS	B-Application
6.0	O
(	O
1992	O
update	O
with	O
BDOS	B-Operating_System
7.1	O
)	O
and	O
higher	O
switched	O
to	O
use	O
a	O
CDS	B-Application
for	O
maximum	B-General_Concept
compatibility	I-General_Concept
with	O
DOS	B-Device
programs	O
as	O
well	O
,	O
they	O
faced	O
the	O
same	O
limitations	O
as	O
present	O
in	O
other	O
DOSes	O
.	O
</s>
<s>
Most	O
programming	O
languages	O
provide	O
an	O
interface	B-Application
to	O
the	O
file	B-Application
system	I-Application
functions	O
of	O
the	O
operating	B-General_Concept
system	I-General_Concept
,	O
including	O
the	O
ability	O
to	O
set	O
(	O
change	O
)	O
the	O
working	O
directory	B-Application
of	O
the	O
program	O
.	O
</s>
<s>
In	O
the	O
C	B-Language
language	I-Language
,	O
the	O
POSIX	O
function	O
chdir( )	O
effects	O
the	O
system	B-Operating_System
call	I-Operating_System
which	O
changes	O
the	O
working	O
directory	B-Application
.	O
</s>
<s>
Its	O
argument	O
is	O
a	O
text	O
string	O
with	O
a	O
path	B-Application
to	O
the	O
new	O
directory	B-Application
,	O
either	O
absolute	O
or	O
relative	O
to	O
the	O
old	O
one	O
.	O
</s>
<s>
Where	O
available	O
,	O
it	O
can	O
be	O
called	O
by	O
a	O
process	B-Operating_System
to	O
set	O
its	O
working	O
directory	B-Application
.	O
</s>
<s>
In	O
Visual	B-Language
Basic	I-Language
it	O
is	O
usually	O
spelled	O
CHDIR( )	O
.	O
</s>
<s>
Unlike	O
the	O
Windows	B-Library
API	I-Library
or	O
POSIX	O
C	B-Language
function	O
,	O
neither	O
the	O
Java	B-Language
programming	I-Language
language	I-Language
nor	O
the	O
Java	B-Language
Virtual	I-Language
Machine	I-Language
supports	O
chdir( )	O
directly	O
;	O
a	O
change	O
request	O
remained	O
open	O
for	O
over	O
a	O
decade	O
while	O
the	O
team	O
responsible	O
for	O
Java	B-Language
considered	O
the	O
alternatives	O
,	O
though	O
by	O
2008	O
the	O
request	O
was	O
denied	O
after	O
only	O
limited	O
support	O
was	O
introduced	O
(	O
affecting	O
first	O
java.lang.Runtime	O
and	O
later	O
,	O
java.lang.ProcessBuilder	O
)	O
.	O
</s>
