Terminal: profiles.json "startingDirectory" : "%SYSTEMDRIVE%" points to system32

Created on 24 Jun 2019  路  1Comment  路  Source: microsoft/terminal

Environment

Microsoft Windows [Version 10.0.18362.175]
Windows Terminal version (if applicable): latest from the store

Steps to reproduce

  1. Modify any profile in profiles.json such that
    "startingDirectory" : "%SYSTEMDRIVE%",
  2. Launch the profile

    Expected behavior

Starting dir is the system drive, e.g. C

Actual behavior

Starting dir is %SYSTEMDRIVE%system32
https://i.imgur.com/hyT2wi7.png

Note

%systemroot% works fine, didn't check other env vars

Area-Settings Issue-Question Product-Meta Resolution-By-Design

Most helpful comment

This is just a quirk of how paths on Windows work! Here's something neat. %SYSTEMDRIVE% expands to C:, but...

C: is a "relative" path, it's just relative to "which folder is currently active on the C drive"... which is a behavior that dates back to DOS 2.0.

As an example, if I set my "active directory" on my _E_ drive to E:\src, I can do this:

dir E:openconsole

and I'll get the response:

 Volume in drive E is Thorium
 Volume Serial Number is 1AF0-C31B

 Directory of e:\src\openconsole  <-- here!

Anyway, the way around this is to use %SYSTEMDRIVE%\ (which you'll need to properly escape for JSON) which makes it an absolute path anchored at your system drive.

_We, of course, cannot change any of this. It's old Windows and DOS arcana that people love to rely on. It lets you do things like COPY A:bigfile C:bigfile2 without specifying directories, which can get long and annoying._

>All comments

This is just a quirk of how paths on Windows work! Here's something neat. %SYSTEMDRIVE% expands to C:, but...

C: is a "relative" path, it's just relative to "which folder is currently active on the C drive"... which is a behavior that dates back to DOS 2.0.

As an example, if I set my "active directory" on my _E_ drive to E:\src, I can do this:

dir E:openconsole

and I'll get the response:

 Volume in drive E is Thorium
 Volume Serial Number is 1AF0-C31B

 Directory of e:\src\openconsole  <-- here!

Anyway, the way around this is to use %SYSTEMDRIVE%\ (which you'll need to properly escape for JSON) which makes it an absolute path anchored at your system drive.

_We, of course, cannot change any of this. It's old Windows and DOS arcana that people love to rely on. It lets you do things like COPY A:bigfile C:bigfile2 without specifying directories, which can get long and annoying._

Was this page helpful?
0 / 5 - 0 ratings