Skip to main content
added "other approaches" and popd
Source Link
Blindspots
  • 3.2k
  • 2
  • 18
  • 23

Using cd/chdir you cannot change the current working directory (CWD) to one on a different drive unless first switching drives (2 steps) or including the /d switch as part of your command (1 step).

cd /? will display the command's help text.

From C:\Users\jessy to E:\MyData

     2 STEPS
  
1 |  C:\Users\jessy> E:
2 |  E:\> cd \MyData        // also 'cd E:\MyData' & 'cd MyData'
  |  E:\MyData>                         
    

     1 STEP

1 |  C:\Users\jessy> cd /d E:\MyData
  |  E:\MyData>

Credit to Señor CMasMas for pointing out the shorter method.

  ��

Additional Reading


The way cd deals with drives and directories reflects its roots in DOS. Windows really only has one current directory, however cmd.exe uses environment variables tied to that particular session to set and maintain it's own current directory for each drive separate from Windows as well as any other cmd.exe instances. If you'd like to read more, I have included a few links to get you started.

   

Other Approaches


pushd [ credit: user @printf ]

Using cd/chdir you cannot change the current working directory (CWD) to one on a different drive unless first switching drives (2 steps) or including the /d switch as part of your command (1 step).

cd /? will display the command's help text.

From C:\Users\jessy to E:\MyData

     2 STEPS
  
1 |  C:\Users\jessy> E:
2 |  E:\> cd \MyData        // also 'cd E:\MyData' & 'cd MyData'
  |  E:\MyData>                         
    

     1 STEP

1 |  C:\Users\jessy> cd /d E:\MyData
  |  E:\MyData>

Credit to Señor CMasMas for pointing out the shorter method.

   

Additional Reading


The way cd deals with drives and directories reflects its roots in DOS. Windows really only has one current directory, however cmd.exe uses environment variables tied to that particular session to set and maintain it's own current directory for each drive separate from Windows as well as any other cmd.exe instances. If you'd like to read more, I have included a few links to get you started.

Using cd/chdir you cannot change the current working directory (CWD) to one on a different drive unless first switching drives (2 steps) or including the /d switch as part of your command (1 step).

cd /? will display the command's help text.

From C:\Users\jessy to E:\MyData

     2 STEPS
  
1 |  C:\Users\jessy> E:
2 |  E:\> cd \MyData        // also 'cd E:\MyData' & 'cd MyData'
  |  E:\MyData>                         
    

     1 STEP

1 |  C:\Users\jessy> cd /d E:\MyData
  |  E:\MyData>

Credit to Señor CMasMas for pointing out the shorter method.

   

Additional Reading


The way cd deals with drives and directories reflects its roots in DOS. Windows really only has one current directory, however cmd.exe uses environment variables tied to that particular session to set and maintain it's own current directory for each drive separate from Windows as well as any other cmd.exe instances. If you'd like to read more, I have included a few links to get you started.

   

Other Approaches


pushd [ credit: user @printf ]

edited to emphasize the disconnect between the pseudo-CWD's and windows own CWD
Source Link
Blindspots
  • 3.2k
  • 2
  • 18
  • 23

Using cd/chdir you cannot change the current working directory (CWD) to one on a different drive unless first switching drives (2 steps) or including the /d switch as part of your command (1 step).

cd /? will display the command's help text.

From C:\Users\jessy to E:\MyData

     2 STEPS
  
1 |  C:\Users\jessy> E:
2 |  E:\> cd \MyData        // also 'cd E:\MyData' & 'cd MyData'
  |  E:\MyData>                         
    

     1 STEP

1 |  C:\Users\jessy> cd /d E:\MyData
  |  E:\MyData>

Credit to Señor CMasMas for pointing out the shorter method.

   

Additional Reading


The way cd deals with drives and directories reflects its roots in DOS. Windows really only has one current directory;directory, however cmd.exe uses environment variables tied to that particular session to set and maintain ait's own current directory for each drive separate from Windows as well as any other cmd.exe instances. IfIf you'd like to read more, I have included a few links to get you started.

Using cd/chdir you cannot change the current working directory (CWD) to one on a different drive unless first switching drives (2 steps) or including the /d switch as part of your command (1 step).

cd /? will display the command's help text.

From C:\Users\jessy to E:\MyData

     2 STEPS
  
1 |  C:\Users\jessy> E:
2 |  E:\> cd \MyData        // also 'cd E:\MyData' & 'cd MyData'
  |  E:\MyData>                         
    

     1 STEP

1 |  C:\Users\jessy> cd /d E:\MyData
  |  E:\MyData>

Credit to Señor CMasMas for pointing out the shorter method.

   

Additional Reading


The way cd deals with drives and directories reflects its roots in DOS. Windows really only has one current directory; however cmd.exe uses environment variables tied to that particular session to maintain a current directory for each drive. If you'd like to read more, I have included a few links to get you started.

Using cd/chdir you cannot change the current working directory (CWD) to one on a different drive unless first switching drives (2 steps) or including the /d switch as part of your command (1 step).

cd /? will display the command's help text.

From C:\Users\jessy to E:\MyData

     2 STEPS
  
1 |  C:\Users\jessy> E:
2 |  E:\> cd \MyData        // also 'cd E:\MyData' & 'cd MyData'
  |  E:\MyData>                         
    

     1 STEP

1 |  C:\Users\jessy> cd /d E:\MyData
  |  E:\MyData>

Credit to Señor CMasMas for pointing out the shorter method.

   

Additional Reading


The way cd deals with drives and directories reflects its roots in DOS. Windows really only has one current directory, however cmd.exe uses environment variables tied to that particular session to set and maintain it's own current directory for each drive separate from Windows as well as any other cmd.exe instances. If you'd like to read more, I have included a few links to get you started.

Spelling and grammar
Source Link
Toby Speight
  • 5k
  • 1
  • 28
  • 38

Using cd/chdir you cannot change the current working directory (CWD) to one on a different drive unless first switching drives (2 steps) or including the /d switch as part of your command (1 step).

cd /? will display the command's help text.

From C:\Users\jessy to E:\MyData

     2 STEPS
  
1 |  C:\Users\jessy> E:
2 |  E:\> cd \MyData        // also 'cd E:\MyData' & 'cd MyData'
  |  E:\MyData>                         
    

     1 STEP

1 |  C:\Users\jessy> cd /d E:\MyData
  |  E:\MyData>

Credit to Señor CMasMas for pointing out the shorter method.

   

Additional Reading


The way cd deals with drives and directories reflects its roots in DOS. Windows really only has one current directorydirectory; however cmd.exe uses environment variables tied to that particular session to maintain pseudo current directoriesa current directory for each drive. If you'd like to read more, I have included a few links to get you started.

Using cd/chdir you cannot change the current working directory (CWD) to one on a different drive unless first switching drives (2 steps) or including the /d switch as part of your command (1 step).

cd /? will display the command's help text.

From C:\Users\jessy to E:\MyData

     2 STEPS
  
1 |  C:\Users\jessy> E:
2 |  E:\> cd \MyData        // also 'cd E:\MyData' & 'cd MyData'
  |  E:\MyData>                         
    

     1 STEP

1 |  C:\Users\jessy> cd /d E:\MyData
  |  E:\MyData>

Credit to Señor CMasMas for pointing out the shorter method.

   

Additional Reading


The way cd deals with drives and directories reflects its roots in DOS. Windows really only has one current directory however cmd.exe uses environment variables tied to that particular session to maintain pseudo current directories for each drive. If you'd like to read more, I have included a few links to get you started.

Using cd/chdir you cannot change the current working directory (CWD) to one on a different drive unless first switching drives (2 steps) or including the /d switch as part of your command (1 step).

cd /? will display the command's help text.

From C:\Users\jessy to E:\MyData

     2 STEPS
  
1 |  C:\Users\jessy> E:
2 |  E:\> cd \MyData        // also 'cd E:\MyData' & 'cd MyData'
  |  E:\MyData>                         
    

     1 STEP

1 |  C:\Users\jessy> cd /d E:\MyData
  |  E:\MyData>

Credit to Señor CMasMas for pointing out the shorter method.

   

Additional Reading


The way cd deals with drives and directories reflects its roots in DOS. Windows really only has one current directory; however cmd.exe uses environment variables tied to that particular session to maintain a current directory for each drive. If you'd like to read more, I have included a few links to get you started.

Spelling and grammar
Source Link
Toby Speight
  • 5k
  • 1
  • 28
  • 38
Loading
Simplify explanation. Provide additional information about what underpins the behavior.
Source Link
Blindspots
  • 3.2k
  • 2
  • 18
  • 23
Loading
had a typo in example, where I showed the directory as `C:\` when it would in fact have been `C:\Users\jessy\`
Source Link
Blindspots
  • 3.2k
  • 2
  • 18
  • 23
Loading
Modified based on @Señor_CMasMas edits
Source Link
Blindspots
  • 3.2k
  • 2
  • 18
  • 23
Loading
Added helpful information on the -D flag.
Source Link
Señor CMasMas
  • 5.6k
  • 1
  • 13
  • 32
Loading
Source Link
Blindspots
  • 3.2k
  • 2
  • 18
  • 23
Loading