-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange starting directory when launched from explorer.exe's address bar #12640
Comments
Correction: |
https://ss64.com/nt/syntax-variables.html
Other S/O post that may be helpful: https://stackoverflow.com/questions/20156490/why-cant-i-access-a-variable-named-cd-on-windows-7/20169219#20169219 Just from skimming those, I'm betting whatever weird logic the OS uses to figure out Consider the following test cases, from the explorer address bar:
You'll get the following windows:
Probably best to not rely on %CD% at all - I've a mind to change where Reading between the lines though, you probably want to use @eryksun is usually my go-to person for explaining the weird quirks of how environment variables are expanded. He can go ahead and correct whatever mistakes I've inevitably made explaining here. |
Currently, When a process is spawned via |
Windows Terminal version
1.4.201119003-release1.4
Windows build number
10.0.19042.685
Other Software
No response
Steps to reproduce
Config the starting directory of the default profile
Run
wt
from the win+r diaglog:Run
wt
from explorer.exe's address bar when cwd of explorer is something like%userprofile%\Downloads
:check the
%__cd__%
variable:Config the starting directory of the default profile
Run
wt
from the win+r diaglog:Run
wt
from explorer.exe's address bar, still not same as cwd:Config
startingDirectory
to%CD%\
or remove it from the profile:the same as
"%CD%"
.Maybe related #7204 #12602
Expected Behavior
In some previous version which I cannot figure out, the terminal is launched the same path as the explorer.
Actual Behavior
I've not updated to the latest build because of a problem related to #6591, the
.msixbundle
file itself will cause a file system error,but I can reproduce the problem on some other computers with new builds.
Additional problem:
The
wt
launched by explorer differs from that launched bywin+r
dialog not only in starting directory. There's also a special environment variable when launched from explorer.Run
!peb
in WinDbg will getThis is the one launched from
win+r
And the entry
=::=::\
is added to explorer's environment after the terminal process is spawned.The text was updated successfully, but these errors were encountered: