PATH variable not working at all in Terminal #22558

Closed
opened 2026-01-31 08:16:39 +00:00 by claunia · 76 comments
Owner

Originally created by @Le-Fleurrr on GitHub (Nov 15, 2024).

Windows Terminal version

1.21.2911.0

Windows build number

10.0.22631.4460

Other Software

The Windows Terminal doesn't seem to be reading the PATH variable. You see, when I add the System32 to the PATH variable it should be working. I added the file path to both User and System variables. And ive restarted terminal. Any help is appreciated, thank you

Steps to reproduce

When I type the command "ipconfig" it says it is not recognized as an internal or external command, operable program or batch file.

Expected Behavior

For the command "ipconfig" to work of course

Actual Behavior

"ipconfig" is not recognized as an internal or external command,
operable program or batch file.Image

Originally created by @Le-Fleurrr on GitHub (Nov 15, 2024). ### Windows Terminal version 1.21.2911.0 ### Windows build number 10.0.22631.4460 ### Other Software The Windows Terminal doesn't seem to be reading the PATH variable. You see, when I add the System32 to the PATH variable it should be working. I added the file path to both User and System variables. And ive restarted terminal. Any help is appreciated, thank you ### Steps to reproduce When I type the command "ipconfig" it says it is not recognized as an internal or external command, operable program or batch file. ### Expected Behavior For the command "ipconfig" to work of course ### Actual Behavior "ipconfig" is not recognized as an internal or external command, operable program or batch file.![Image](https://github.com/user-attachments/assets/b00677bb-bee1-4fc1-af2f-e7fb27f70c8c)
claunia added the Needs-TriageIssue-BugNeeds-Attention labels 2026-01-31 08:16:39 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Nov 15, 2024):

You're also in system32 as your CWD in that screenshot, so CMD shouldn't even need the PATH to find it.

Here's a possibly silly question - is ipconfig somehow missing from system32/?

dir c:\windows\system32 | findstr ipconfig

should output something like 02/13/2024 01:29 PM 53,248 ipconfig.exe

@zadjii-msft commented on GitHub (Nov 15, 2024): You're also _in_ `system32` as your CWD in that screenshot, so CMD shouldn't even need the `PATH` to find it. Here's a possibly silly question - is `ipconfig` somehow missing from system32/? ``` dir c:\windows\system32 | findstr ipconfig ``` should output something like `02/13/2024 01:29 PM 53,248 ipconfig.exe`
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 15, 2024):

'findstr' is not recognized as an internal or external command,
operable program or batch file.

@Le-Fleurrr commented on GitHub (Nov 15, 2024): 'findstr' is not recognized as an internal or external command, operable program or batch file.
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 15, 2024):

Ok I kinda fixed it by pasting the full path of fndstr Image

@Le-Fleurrr commented on GitHub (Nov 15, 2024): Ok I kinda fixed it by pasting the full path of fndstr ![Image](https://github.com/user-attachments/assets/f8b5ec52-ad87-4c4c-843d-894d8e4e3bf2)
Author
Owner

@zadjii-msft commented on GitHub (Nov 15, 2024):

Uh okay what

what does this dialog look like?

Image

What does echo %PATH% emit?

If you hit win+R, then use the run dialog to launch conhost.exe, then run echo %PATH%, what does that output/?

@zadjii-msft commented on GitHub (Nov 15, 2024): Uh okay _what_ what does this dialog look like? ![Image](https://github.com/user-attachments/assets/9aa88045-6055-4bf5-b9e3-35f22651f9f1) What does `echo %PATH%` emit? If you hit <kbd>win+R</kbd>, then use the run dialog to launch `conhost.exe`, then run `echo %PATH%`, what does that output/?
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 15, 2024):

Image

And here is what CMD echo %PATH% says:

C:\Windows\System32\;C:\Program Files\dotnet;C:\HaxeToolkit;C:\Program Files\dotnet\sdk;C:\Windows\System32\;C:\WINDOWS\System32\;C:\Users\tahir\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\tahir\AppData\Local\Programs\oh-my-posh\bin;C:\HaxeToolkit\haxe;C:\HaxeToolkit\neko;C:\HaxeToolkit\haxe\haxelib.exe;C:\Users\tahir\.dotnet\tools;C:\Program Files\mingw64\x86_64-w64-mingw32;C:\HaxeToolkit;C:\Program Files\Git\cmd;C:\Program Files\Git\bin;C:\mingw-64\x86_64-14.2.0-release-posix-seh-ucrt-rt_v12-rev0\mingw64\bin;C:\Program Files\dotnet;C:\Program Files\dotnet\sdk;C:\Windows\System32\;C:\Program Files\dotnet;C:\HaxeToolkit;C:\Program Files\dotnet\sdk;C:\Windows\System32\;C:\WINDOWS\System32\;C:\Users\tahir\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\tahir\AppData\Local\Programs\oh-my-posh\bin;C:\HaxeToolkit\haxe;C:\HaxeToolkit\neko;C:\HaxeToolkit\haxe\haxelib.exe;C:\Users\tahir\.dotnet\tools;C:\Program Files\mingw64\x86_64-w64-mingw32;C:\HaxeToolkit;C:\Program Files\Git\cmd;C:\Program Files\Git\bin;C:\mingw-64\x86_64-14.2.0-release-posix-seh-ucrt-rt_v12-rev0\mingw64\bin;C:\Program Files\dotnet;C:\Program Files\dotnet\sdk;C:\mingw-64\x86_64-14.2.0-release-posix-seh-ucrt-rt_v12-rev0\mingw64\bin;
@Le-Fleurrr commented on GitHub (Nov 15, 2024): ![Image](https://github.com/user-attachments/assets/b4fa410f-6972-4f28-97f7-a6fdfe9b4681) And here is what CMD echo %PATH% says: ``` C:\Windows\System32\;C:\Program Files\dotnet;C:\HaxeToolkit;C:\Program Files\dotnet\sdk;C:\Windows\System32\;C:\WINDOWS\System32\;C:\Users\tahir\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\tahir\AppData\Local\Programs\oh-my-posh\bin;C:\HaxeToolkit\haxe;C:\HaxeToolkit\neko;C:\HaxeToolkit\haxe\haxelib.exe;C:\Users\tahir\.dotnet\tools;C:\Program Files\mingw64\x86_64-w64-mingw32;C:\HaxeToolkit;C:\Program Files\Git\cmd;C:\Program Files\Git\bin;C:\mingw-64\x86_64-14.2.0-release-posix-seh-ucrt-rt_v12-rev0\mingw64\bin;C:\Program Files\dotnet;C:\Program Files\dotnet\sdk;C:\Windows\System32\;C:\Program Files\dotnet;C:\HaxeToolkit;C:\Program Files\dotnet\sdk;C:\Windows\System32\;C:\WINDOWS\System32\;C:\Users\tahir\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\tahir\AppData\Local\Programs\oh-my-posh\bin;C:\HaxeToolkit\haxe;C:\HaxeToolkit\neko;C:\HaxeToolkit\haxe\haxelib.exe;C:\Users\tahir\.dotnet\tools;C:\Program Files\mingw64\x86_64-w64-mingw32;C:\HaxeToolkit;C:\Program Files\Git\cmd;C:\Program Files\Git\bin;C:\mingw-64\x86_64-14.2.0-release-posix-seh-ucrt-rt_v12-rev0\mingw64\bin;C:\Program Files\dotnet;C:\Program Files\dotnet\sdk;C:\mingw-64\x86_64-14.2.0-release-posix-seh-ucrt-rt_v12-rev0\mingw64\bin; ```
Author
Owner

@zadjii-msft commented on GitHub (Nov 15, 2024):

And just to be sure - it's the same PATH in both conhost and the Windows Terminal?

There was an environment loading bug a few releases back.... but I can't recall if that was still in 1.21. Terminal Preview surely wouldn't have that bug anymore.

It does look like your path has quite a few duplicates in it. I don't think that would cause issues, but it's curious to say the least.

I'm at a loss. I don't know why CMD would fail to find ipconfig when you're literally in system32.

@zadjii-msft commented on GitHub (Nov 15, 2024): And just to be sure - it's the same `PATH` in both conhost and the Windows Terminal? There was an environment loading bug a few releases back.... but I can't recall if that was still in 1.21. Terminal Preview surely wouldn't have that bug anymore. It does look like your path has quite a few duplicates in it. I don't think that would cause issues, but it's curious to say the least. I'm at a loss. I don't know why CMD would fail to find `ipconfig` when you're _literally in system32_.
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 15, 2024):

Same, but yeah it's the same in Terminal.

@Le-Fleurrr commented on GitHub (Nov 15, 2024): Same, but yeah it's the same in Terminal.
Author
Owner

@o-sdn-o commented on GitHub (Nov 15, 2024):

Looks a lot like case sensitivity issues. https://learn.microsoft.com/en-us/windows/wsl/case-sensitivity

  • Test:
    C:\Windows\System32\fsutil.exe file queryCaseSensitiveInfo C:\
    C:\Windows\System32\fsutil.exe file queryCaseSensitiveInfo C:\Windows
    C:\Windows\System32\fsutil.exe file queryCaseSensitiveInfo C:\Windows\System32
    
    
@o-sdn-o commented on GitHub (Nov 15, 2024): Looks a lot like case sensitivity issues. https://learn.microsoft.com/en-us/windows/wsl/case-sensitivity - `Test`: ``` C:\Windows\System32\fsutil.exe file queryCaseSensitiveInfo C:\ C:\Windows\System32\fsutil.exe file queryCaseSensitiveInfo C:\Windows C:\Windows\System32\fsutil.exe file queryCaseSensitiveInfo C:\Windows\System32 ```
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 16, 2024):

Case sensitive attribute on directory C:\ is disabled.
Case sensitive attribute on directory C:\Windows is disabled.
Case sensitive attribute on directory C:\Windows\System32 is disabled.

Image

Is this good or not??

@Le-Fleurrr commented on GitHub (Nov 16, 2024): Case sensitive attribute on directory C:\ is disabled. Case sensitive attribute on directory C:\Windows is disabled. Case sensitive attribute on directory C:\Windows\System32 is disabled. ![Image](https://github.com/user-attachments/assets/5fcb19fd-6fa7-4943-9fc1-3e5d19e2c708) Is this good or not??
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

Is this good or not??

This is okay.

Maybe some registry key is involved.

I think you need to dig in that direction.

@o-sdn-o commented on GitHub (Nov 16, 2024): > Is this good or not?? This is okay. Maybe some registry key is involved. - https://devblogs.microsoft.com/commandline/per-directory-case-sensitivity-and-wsl/ Run in command prompt: ``` reg query "HKLM\SYSTEM\CurrentControlSet\Services\lxss" /v DrvFsAllowForceCaseSensitivity ``` Expected output: ``` ERROR: The system was unable to find the specified registry key or value. (DWORD:DrvFsAllowForceCaseSensitivity is absent by default) ``` - https://superuser.com/questions/266110/how-do-you-make-windows-7-fully-case-sensitive-with-respect-to-the-filesystem Run in command prompt: ``` reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel" /v ObCaseInsensitive ``` Expected output: ``` ObCaseInsensitive REG_DWORD 0x0 : case-sensitivity is enabled ObCaseInsensitive REG_DWORD 0x1 : case-sensitivity is disabled (default) ``` I think you need to dig in that direction.
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

Also check the following

cd \
cd C:\Windows\System32
ipconfig

This will work if it is a case-sensitivity issue.

If so, edit the PATH variable (as well as all other paths anywhere in the system) by removing the broken case references to C:\Windows\System32 and leave only the correct one.

@o-sdn-o commented on GitHub (Nov 16, 2024): Also check the following ``` cd \ cd C:\Windows\System32 ipconfig ``` This will work if it is a case-sensitivity issue. If so, edit the PATH variable (as well as all other paths anywhere in the system) by removing the broken case references to `C:\Windows\System32` and leave only the correct one.
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 16, 2024):

Image
Image

Also I've changed casesensitiveinfo to 0 in regedit yet still the same output: ipconfig is not recognized as an internal blah blah blah.

@Le-Fleurrr commented on GitHub (Nov 16, 2024): ![Image](https://github.com/user-attachments/assets/18413ad5-dd91-4f28-84bd-e8ae48ecc8e6) ![Image](https://github.com/user-attachments/assets/f3aafa76-40fd-488d-9820-f610796203f1) Also I've changed casesensitiveinfo to 0 in regedit yet still the same output: ipconfig is not recognized as an internal blah blah blah.
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

What does the following command output? (Note the drive letter C: in upper case)

cd \
cd C:\Windows\System32
find.exe

  • Expected output:
    c:\Windows\System32>cd \
    
    c:\>cd C:\Windows\System32
    
    C:\Windows\System32>find.exe
    FIND: Parameter format not correct
    
    C:\Windows\System32>
    
@o-sdn-o commented on GitHub (Nov 16, 2024): What does the following command output? (Note the drive letter `C:` in upper case) ``` cd \ cd C:\Windows\System32 find.exe ``` - Expected output: ``` c:\Windows\System32>cd \ c:\>cd C:\Windows\System32 C:\Windows\System32>find.exe FIND: Parameter format not correct C:\Windows\System32> ```
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 16, 2024):

Image

Exactly the same

@Le-Fleurrr commented on GitHub (Nov 16, 2024): ![Image](https://github.com/user-attachments/assets/b4e4d2ba-5d61-4d02-9339-7bebb02a6c3b) Exactly the same
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

So, it's definitely a case-sensitivity issue. It is not.

@o-sdn-o commented on GitHub (Nov 16, 2024): ~~So, it's definitely a case-sensitivity issue.~~ It is not.
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 16, 2024):

So how do I fix it?

@Le-Fleurrr commented on GitHub (Nov 16, 2024): So how do I fix it?
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

cmd.exe is case insensitive for drive letters and places them in the case specified, and in this situation only uppercase letters are allowed. It looks like you should change drive letters to uppercase everywhere in the terminal configs.

Or you need to find whatever turned on case-sensitivity in your system and disable it.

@o-sdn-o commented on GitHub (Nov 16, 2024): cmd.exe is case insensitive for drive letters and places them in the case specified, and in this situation only uppercase letters are allowed. It looks like you should change drive letters to uppercase everywhere in the terminal configs. Or you need to find whatever turned on case-sensitivity in your system and disable it.
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

So this looks like an issue on the cmd.exe side. They don't check for case when they need to.

@o-sdn-o commented on GitHub (Nov 16, 2024): ~~So this looks like an issue on the cmd.exe side. They don't check for case when they need to.~~
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 16, 2024):

How should I change the CMD's config files?

@Le-Fleurrr commented on GitHub (Nov 16, 2024): How should I change the CMD's config files?
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

All occurrences of "commandline" option in settings.json (Windows Terminal->Settings->Open JSON file) must contain uppercase drive letters in their values.

@o-sdn-o commented on GitHub (Nov 16, 2024): All occurrences of "commandline" option in `settings.json` (Windows Terminal->Settings->Open JSON file) must contain uppercase drive letters in their values.
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 16, 2024):

Image
What would it be in this case?

@Le-Fleurrr commented on GitHub (Nov 16, 2024): ![Image](https://github.com/user-attachments/assets/106b378b-0d40-4af0-a9b3-1e7850590a58) What would it be in this case?
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

Replace %SystemRoot% with C:\Windows.

@o-sdn-o commented on GitHub (Nov 16, 2024): Replace `%SystemRoot%` with `C:\Windows`.
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 16, 2024):

Image

@Le-Fleurrr commented on GitHub (Nov 16, 2024): ![Image](https://github.com/user-attachments/assets/81c70508-c973-4e1e-bcda-d75b1adcd226)
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

Sorry, with C:\\Windows.

@o-sdn-o commented on GitHub (Nov 16, 2024): Sorry, with `C:\\Windows`.
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 16, 2024):

Woops figured it out. Do I have to restart my Laptop for it to work? Cause it doesn't right now.

@Le-Fleurrr commented on GitHub (Nov 16, 2024): Woops figured it out. Do I have to restart my Laptop for it to work? Cause it doesn't right now.
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

No. It should work instantly. (Just create a new tab with cmd profile)

@o-sdn-o commented on GitHub (Nov 16, 2024): No. It should work instantly. (Just create a new tab with cmd profile)
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 16, 2024):

Image

@Le-Fleurrr commented on GitHub (Nov 16, 2024): ![Image](https://github.com/user-attachments/assets/ef076ff7-ee32-4190-9fa3-f39b8f59f2d7)
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

Could you show the output of the set command?

set

or

echo %HOMEDRIVE%

@o-sdn-o commented on GitHub (Nov 16, 2024): Could you show the output of the `set` command? ``` set ``` or ``` echo %HOMEDRIVE% ```
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

I'm trying to find a way to make my system case-sensitive to reproduce your experience, but so far no success. You have a lowercase drive letter C: coming from somewhere, it’s not clear where it comes from.

@o-sdn-o commented on GitHub (Nov 16, 2024): I'm trying to find a way to make my system case-sensitive to reproduce your experience, but so far no success. You have a lowercase drive letter C: coming from somewhere, it’s not clear where it comes from.
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

Could you try to set the starting directory option to C:\Windows\System32?
Image

@o-sdn-o commented on GitHub (Nov 16, 2024): Could you try to set the starting directory option to `C:\Windows\System32`? ![Image](https://github.com/user-attachments/assets/8cab78f3-6318-4a24-b5a7-f5f4780077fd)
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 16, 2024):

Ugh it still doesn't recognize ipconfig

@Le-Fleurrr commented on GitHub (Nov 16, 2024): Ugh it still doesn't recognize ipconfig
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

I think I found a workaround for this. Try to set the command option to C:\Windows\System32\cmd.exe /k "cd \ && cd C:\Windows\System32\":

Image

@o-sdn-o commented on GitHub (Nov 16, 2024): I think I found a workaround for this. Try to set the command option to `C:\Windows\System32\cmd.exe /k "cd \ && cd C:\Windows\System32\"`: ![Image](https://github.com/user-attachments/assets/1793ba63-7eab-4f67-94cc-10241267dd45)
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 16, 2024):

Nope. Maybe I should dig around in regedit?

@Le-Fleurrr commented on GitHub (Nov 16, 2024): Nope. Maybe I should dig around in regedit?
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

I don't know what else to look at or do. I'm also interested in how to get a system configuration like yours with case-sensitivity in the C drive partition.

@o-sdn-o commented on GitHub (Nov 16, 2024): I don't know what else to look at or do. I'm also interested in how to get a system configuration like yours with case-sensitivity in the C drive partition.
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 16, 2024):

Should I look somewhere for the system config then? Maybe if I send it you'll look at it, 'cause idk what 2 do anymore.

@Le-Fleurrr commented on GitHub (Nov 16, 2024): Should I look somewhere for the system config then? Maybe if I send it you'll look at it, 'cause idk what 2 do anymore.
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

Maybe it's some side effect of some WSL v1 or v2 setting. Maybe something related to DrvFs or Plan9(P9) protocol setting. As soon as I find something to cling to, I'll write here. Maybe someone else will suggest something.

@o-sdn-o commented on GitHub (Nov 16, 2024): Maybe it's some side effect of some WSL v1 or v2 setting. Maybe something related to DrvFs or Plan9(P9) protocol setting. As soon as I find something to cling to, I'll write here. Maybe someone else will suggest something.
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 16, 2024):

Thanks, I'll keep this issue open just in case.

@Le-Fleurrr commented on GitHub (Nov 16, 2024): Thanks, I'll keep this issue open just in case.
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

Are you using WSL? If so, what does C:\Windows\System32\wsl.exe mount output? (or C:\Users\tahir\AppData\Local\Microsoft\WindowsApps\wsl.exe mount)

  • Expected output:
    c:\Windows\System32>C:\Windows\System32\wsl.exe mount 
    none on /usr/lib/modules/5.15.153.1-microsoft-standard-WSL2 type overlay (rw,nosuid,nodev,noatime,lowerdir=/modules,upperdir=/lib/modules/5.15.153.1-microsoft-standard-WSL2/rw/upper,workdir=/lib/modules/5.15.153.1-microsoft-standard-WSL2/rw/work)
    none on /mnt/wsl type tmpfs (rw,relatime)
    ...
    C:\ on /mnt/c type 9p (rw,noatime,dirsync,aname=drvfs;path=C:\;uid=1000;gid=1000;symlinkroot=/mnt/,mmap,access=client,msize=65536,trans=fd,rfd=5,wfd=5)
    D:\ on /mnt/d type 9p (rw,noatime,dirsync,aname=drvfs;path=D:\;uid=1000;gid=1000;symlinkroot=/mnt/,mmap,access=client,msize=65536,trans=fd,rfd=5,wfd=5)
    ...
    
@o-sdn-o commented on GitHub (Nov 16, 2024): Are you using WSL? If so, what does `C:\Windows\System32\wsl.exe mount` output? (or `C:\Users\tahir\AppData\Local\Microsoft\WindowsApps\wsl.exe mount`) - Expected output: ``` c:\Windows\System32>C:\Windows\System32\wsl.exe mount none on /usr/lib/modules/5.15.153.1-microsoft-standard-WSL2 type overlay (rw,nosuid,nodev,noatime,lowerdir=/modules,upperdir=/lib/modules/5.15.153.1-microsoft-standard-WSL2/rw/upper,workdir=/lib/modules/5.15.153.1-microsoft-standard-WSL2/rw/work) none on /mnt/wsl type tmpfs (rw,relatime) ... C:\ on /mnt/c type 9p (rw,noatime,dirsync,aname=drvfs;path=C:\;uid=1000;gid=1000;symlinkroot=/mnt/,mmap,access=client,msize=65536,trans=fd,rfd=5,wfd=5) D:\ on /mnt/d type 9p (rw,noatime,dirsync,aname=drvfs;path=D:\;uid=1000;gid=1000;symlinkroot=/mnt/,mmap,access=client,msize=65536,trans=fd,rfd=5,wfd=5) ... ```
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 16, 2024):

Image

@Le-Fleurrr commented on GitHub (Nov 16, 2024): ![Image](https://github.com/user-attachments/assets/5e7dff05-5a8c-46f9-8af7-eb4f48b88572)
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 16, 2024):

Image
It says I need to install through this command, but uhh, yeah.

@Le-Fleurrr commented on GitHub (Nov 16, 2024): ![Image](https://github.com/user-attachments/assets/6e558c27-58ef-4186-919d-40b553dd2e1e) It says I need to install through this command, but uhh, yeah.
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

Try C:\Windows\System32\wsl.exe --install.

@o-sdn-o commented on GitHub (Nov 16, 2024): ~~Try `C:\Windows\System32\wsl.exe --install`.~~
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

I tried to force case-sensitive attribute on C: partition (by mounting it on another system) and Windows couldn't even boot after that. It looks like case sensitivity on your system only applies to drive letters.

@o-sdn-o commented on GitHub (Nov 16, 2024): I tried to force case-sensitive attribute on C: partition (by mounting it on another system) and Windows couldn't even boot after that. It looks like case sensitivity on your system only applies to drive letters.
Author
Owner

@DHowett commented on GitHub (Nov 16, 2024):

If you haven’t installed WSL, don’t. If you haven’t installed it, it isn’t the cause of your issues. It is also not going to help you to diagnose them.

If you launch the original windows console host directly, by running conhost.exe with the Run dialog, does the problem persist?

@DHowett commented on GitHub (Nov 16, 2024): If you haven’t installed WSL, don’t. If you haven’t installed it, it isn’t the cause of your issues. It is also not going to help you to diagnose them. If you launch the original windows console host directly, by running `conhost.exe` with the Run dialog, does the problem persist?
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

@Mcknight231 Could you run the following?

subst c: C:\
  • Output on my system:
    C:\Users\sdn>subst c: C:\
    Invalid parameter - C:
    
@o-sdn-o commented on GitHub (Nov 16, 2024): @Mcknight231 Could you run the following? ``` subst c: C:\ ``` - Output on my system: ``` C:\Users\sdn>subst c: C:\ Invalid parameter - C: ```
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 16, 2024):

@o-sdn-o same on my end

@Le-Fleurrr commented on GitHub (Nov 16, 2024): @o-sdn-o same on my end
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 16, 2024):

@DHowett Yes, it still persists.

@Le-Fleurrr commented on GitHub (Nov 16, 2024): @DHowett Yes, it still persists.
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

I don't know what to grab onto, but what does the chcp command output?

C:\Windows\System32\chcp.com
  • In my setup it outputs:
    C:\Users\sdn>C:\Windows\System32\chcp.com
    Active code page: 437
    
@o-sdn-o commented on GitHub (Nov 16, 2024): I don't know what to grab onto, but what does the chcp command output? ``` C:\Windows\System32\chcp.com ``` - In my setup it outputs: ``` C:\Users\sdn>C:\Windows\System32\chcp.com Active code page: 437 ```
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 16, 2024):

Active code page: 850

@Le-Fleurrr commented on GitHub (Nov 16, 2024): Active code page: 850
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

Note: The subst.exe command internally aligns the case of all passed parameters, and this is probably why it didn't work.

@o-sdn-o commented on GitHub (Nov 16, 2024): Note: The `subst.exe` command internally aligns the case of all passed parameters, and this is probably why it didn't work.
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 16, 2024):

So what's the solution?

@Le-Fleurrr commented on GitHub (Nov 16, 2024): So what's the solution?
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

Perhaps we need to find (or make) an analogue of the subst command that will accept parameters without changing their case. https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-definedosdevicew

@o-sdn-o commented on GitHub (Nov 16, 2024): Perhaps we need to find (or make) an analogue of the subst command that will accept parameters without changing their case. https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-definedosdevicew
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 16, 2024):

Okay, I'll wait for some kind of solution then, thanks!

@Le-Fleurrr commented on GitHub (Nov 16, 2024): Okay, I'll wait for *some* kind of solution then, thanks!
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

I'll try to make a powershell script that will do this.

@o-sdn-o commented on GitHub (Nov 16, 2024): I'll try to make a powershell script that will do this.
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

Try to run the following powershell script.

  • subst_cs.ps1:
    $win32 = Add-Type -Name WinAPI -PassThru -MemberDefinition @'
    [DllImport("kernel32.dll")] public static extern bool DefineDosDevice(int dwFlags, string lpDeviceName, string lpTargetPath);
    '@
    $rc = $win32::DefineDosDevice(0, "c:", "C:\")
    C:\Windows\System32\cmd.exe /c "dir c:"
    $rc
    
@o-sdn-o commented on GitHub (Nov 16, 2024): Try to run the following powershell script. - `subst_cs.ps1`: ```pwsh $win32 = Add-Type -Name WinAPI -PassThru -MemberDefinition @' [DllImport("kernel32.dll")] public static extern bool DefineDosDevice(int dwFlags, string lpDeviceName, string lpTargetPath); '@ $rc = $win32::DefineDosDevice(0, "c:", "C:\") C:\Windows\System32\cmd.exe /c "dir c:" $rc ```
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

Most likely it won't work. Win32 API function DefineDosDevice converts the disk name to uppercase...

It might make sense to try the same thing with https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setvolumemountpointa (later)

@o-sdn-o commented on GitHub (Nov 16, 2024): Most likely it won't work. Win32 API function DefineDosDevice converts the disk name to uppercase... ~~It might make sense to try the same thing with https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setvolumemountpointa (later)~~
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

What does the command C:\Windows\System32\mountvol.exe output?

C:\Windows\System32\mountvol.exe

@o-sdn-o commented on GitHub (Nov 16, 2024): What does the command `C:\Windows\System32\mountvol.exe` output? ``` C:\Windows\System32\mountvol.exe ```
Author
Owner

@o-sdn-o commented on GitHub (Nov 16, 2024):

I have a theoretical suspicion that in your system in the global names section there may be a symlink with a name in the form of a lowercase c: along with an uppercase C:. This can be inspected using WinObj. There you can sort by name by clicking on the header of the corresponding column.

Image

@o-sdn-o commented on GitHub (Nov 16, 2024): I have a theoretical suspicion that in your system in the global names section there may be a symlink with a name in the form of a lowercase `c:` along with an uppercase `C:`. This can be inspected using [WinObj](https://learn.microsoft.com/en-us/sysinternals/downloads/winobj). There you can sort by name by clicking on the header of the corresponding column. ![Image](https://github.com/user-attachments/assets/7f20b4e9-8d6f-493b-9126-a6ce4043d4aa)
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 17, 2024):

Image

@Le-Fleurrr commented on GitHub (Nov 17, 2024): ![Image](https://github.com/user-attachments/assets/98ac5ac8-2531-43bc-80d9-5d0aece66520)
Author
Owner

@o-sdn-o commented on GitHub (Nov 17, 2024):

I found another clue. It may be related to locale. cmd.exe uses int ::towupper(wint_t c) function to change the case of drive letter, and the result depends on locale.

https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/toupper-toupper-towupper-toupper-l-towupper-l?view=msvc-170

The case conversion of towupper is locale-specific. Only the characters relevant to the current locale are changed in case.

It is possible that under certain conditions the string c:\Windows\System32\... is not converted to the required C:\Windows\System32\...

@o-sdn-o commented on GitHub (Nov 17, 2024): I found another clue. It may be related to locale. cmd.exe uses `int ::towupper(wint_t c)` function to change the case of drive letter, and the result depends on locale. https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/toupper-toupper-towupper-toupper-l-towupper-l?view=msvc-170 > The case conversion of `towupper` is locale-specific. Only the characters relevant to the current locale are changed in case. It is possible that under certain conditions the string `c:\Windows\System32\...` is not converted to the required `C:\Windows\System32\...`
Author
Owner

@DHowett commented on GitHub (Nov 17, 2024):

It is possible that under certain conditions the string c:\Windows\System32\... is not converted to the required C:\Windows\System32\...

To be honest, CMD has about 500 million users. We would have heard about this.

@Mcknight231 would you be willing to install some debugging tools to send us some information? I can try to write them up over the weekend, but the latest I can do it is Monday.

In short, it would be to install Microsoft’s modern Windows Debugger (WinDbg) and recording a Time Travel Trace of CMD.

Install instructions: https://learn.microsoft.com/en-us/windows-hardware/drivers/debuggercmds/

If you follow Section 2 of this guide (https://learn.microsoft.com/en-us/windows-hardware/drivers/debuggercmds/time-travel-debugging-walkthrough#section-2-record-a-trace-of-the-displaygreeting-sample), but use…

Executable: C:\windows\system32\cmd.exe
Arguments: (nothing)
Starting Directory: C:\

And then reproduce the bug in the new CMD window after you follow the steps, it will make a huge file called cmd01.run that you can share with us.

Step 7 says to make the app crash, but you can just reproduce your bug and then exit!

@DHowett commented on GitHub (Nov 17, 2024): > It is possible that under certain conditions the string `c:\Windows\System32\...` is not converted to the required `C:\Windows\System32\...` To be honest, CMD has about 500 *million* users. We would have heard about this. @Mcknight231 would you be willing to install some debugging tools to send us some information? I can try to write them up over the weekend, but the latest I can do it is Monday. In short, it would be to install Microsoft’s modern Windows Debugger (WinDbg) and recording a Time Travel Trace of CMD. Install instructions: https://learn.microsoft.com/en-us/windows-hardware/drivers/debuggercmds/ If you follow Section 2 of this guide (https://learn.microsoft.com/en-us/windows-hardware/drivers/debuggercmds/time-travel-debugging-walkthrough#section-2-record-a-trace-of-the-displaygreeting-sample), but use… ``` Executable: C:\windows\system32\cmd.exe Arguments: (nothing) Starting Directory: C:\ ``` And then reproduce the bug in the new CMD window after you follow the steps, it will make a huge file called cmd01.run that you can share with us. Step 7 says to make the app crash, but you can just reproduce your bug and then `exit`!
Author
Owner

@DHowett commented on GitHub (Nov 17, 2024):

This will allow a Microsoft engineer, or o-sdn-o, to step through the execution of CMD while it is looking for commands in your PATH.

@DHowett commented on GitHub (Nov 17, 2024): This will allow a Microsoft engineer, or o-sdn-o, to step through the execution of CMD while it is looking for commands in your `PATH`.
Author
Owner

@o-sdn-o commented on GitHub (Nov 17, 2024):

Last question, to satisfy my curiosity please, what does the command output?

C:\Windows\System32\systeminfo.exe | C:\Windows\System32\findstr.exe Locale

or simply (in case the word "Locale" is localized in your language)

C:\Windows\System32\systeminfo.exe
  • Expected output:
    c:\Windows\System32>C:\Windows\System32\systeminfo.exe | C:\Windows\System32\findstr.exe Locale
    System Locale:             en-us;English (United States)
    Input Locale:              en-us;English (United States)
    
@o-sdn-o commented on GitHub (Nov 17, 2024): ~~Last question~~, to satisfy my curiosity please, what does the command output? ``` C:\Windows\System32\systeminfo.exe | C:\Windows\System32\findstr.exe Locale ``` or simply (in case the word "Locale" is localized in your language) ``` C:\Windows\System32\systeminfo.exe ``` - Expected output: ``` c:\Windows\System32>C:\Windows\System32\systeminfo.exe | C:\Windows\System32\findstr.exe Locale System Locale: en-us;English (United States) Input Locale: en-us;English (United States) ```
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 17, 2024):

c:\Windows\System32>C:\Windows\System32\systeminfo.exe | C:\Windows\System32\findstr.exe Locale
System Locale: en-gb;English (United Kingdom)
Input Locale: en-gb;English (United Kingdom)

@Le-Fleurrr commented on GitHub (Nov 17, 2024): c:\Windows\System32>C:\Windows\System32\systeminfo.exe | C:\Windows\System32\findstr.exe Locale System Locale: en-gb;English (United Kingdom) Input Locale: en-gb;English (United Kingdom)
Author
Owner

@o-sdn-o commented on GitHub (Nov 17, 2024):

I found another interesting clue. Could you run the following:

set PATHEXT=
find

  • In my setup I see the following:
    c:\Windows\System32>set PATHEXT="qqq"
    
    c:\Windows\System32>find
    'find' is not recognized as an internal or external command,
    operable program or batch file.
    
    c:\Windows\System32>set PATHEXT=
    
    c:\Windows\System32>find
    FIND: Parameter format not correct
    
    c:\Windows\System32>
    
@o-sdn-o commented on GitHub (Nov 17, 2024): I found another interesting clue. Could you run the following: ``` set PATHEXT= find ``` - In my setup I see the following: ``` c:\Windows\System32>set PATHEXT="qqq" c:\Windows\System32>find 'find' is not recognized as an internal or external command, operable program or batch file. c:\Windows\System32>set PATHEXT= c:\Windows\System32>find FIND: Parameter format not correct c:\Windows\System32> ```
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 17, 2024):

c:\Windows\System32>set PATHEXT="qqq"

c:\Windows\System32>find
'find' is not recognized as an internal or external command,
operable program or batch file.

c:\Windows\System32>set PATHTEXT =

c:\Windows\System32>find
'find' is not recognized as an internal or external command,
operable program or batch file.
Image

@Le-Fleurrr commented on GitHub (Nov 17, 2024): c:\Windows\System32>set PATHEXT="qqq" c:\Windows\System32>find 'find' is not recognized as an internal or external command, operable program or batch file. c:\Windows\System32>set PATHTEXT = c:\Windows\System32>find 'find' is not recognized as an internal or external command, operable program or batch file. ![Image](https://github.com/user-attachments/assets/14b76f1c-4d81-4f4c-a9c5-fccbb1ac4fea)
Author
Owner

@o-sdn-o commented on GitHub (Nov 17, 2024):

No! Please run exactlyset PATHEXT= (without space before equal)

set PATHEXT=
@o-sdn-o commented on GitHub (Nov 17, 2024): No! Please run exactly`set PATHEXT=` (without space before equal) ``` set PATHEXT= ```
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 17, 2024):

@DHowett i did it aand here it is:https://www.mediafire.com/file/4kxtvhvjec2cn3h/cmd01.run/file

@Le-Fleurrr commented on GitHub (Nov 17, 2024): @DHowett i did it aand here it is:https://www.mediafire.com/file/4kxtvhvjec2cn3h/cmd01.run/file
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 17, 2024):

@o-sdn-o Image

@Le-Fleurrr commented on GitHub (Nov 17, 2024): @o-sdn-o ![Image](https://github.com/user-attachments/assets/2761926b-fe08-4086-9e2c-f834b2f145dd)
Author
Owner

@o-sdn-o commented on GitHub (Nov 17, 2024):

It seems a cure has been found. Having a PATHEXT variable with an incorrect value was apparently the cause of the problems. Just remove it if it is set somewhere.

@o-sdn-o commented on GitHub (Nov 17, 2024): It seems a cure has been found. Having a `PATHEXT` variable with an incorrect value was apparently the cause of the problems. Just remove it if it is set somewhere.
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 17, 2024):

Or how can I change the PATHTEXT to be correct>

@Le-Fleurrr commented on GitHub (Nov 17, 2024): Or how can I change the PATHTEXT to be correct>
Author
Owner

@o-sdn-o commented on GitHub (Nov 17, 2024):

Look for the PATHEXT (not PATHTEXT) variable and remove (or fix) it here:
Image

@o-sdn-o commented on GitHub (Nov 17, 2024): Look for the PATHEXT (not PATHTEXT) variable and remove (or fix) it here: ![Image](https://github.com/user-attachments/assets/5f74c222-e2cc-4620-9cdc-763a7353cb45)
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 17, 2024):

Image

So should I modify it our just completely delete it?

@Le-Fleurrr commented on GitHub (Nov 17, 2024): ![Image](https://github.com/user-attachments/assets/b3376612-809a-4e05-adb5-517bffa17edc) So should I modify it our just completely delete it?
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 17, 2024):

OH MY GOD IT WORKED? But how can a variable mess up the commands for CMD? Tysm man!

@Le-Fleurrr commented on GitHub (Nov 17, 2024): OH MY GOD IT WORKED? But how can a variable mess up the commands for CMD? Tysm man!
Author
Owner

@o-sdn-o commented on GitHub (Nov 17, 2024):

Default value on Win10

PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
@o-sdn-o commented on GitHub (Nov 17, 2024): Default value on Win10 ``` PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC ```
Author
Owner

@Le-Fleurrr commented on GitHub (Nov 17, 2024):

Huh, okay thanks! Im gonna close this issue now.

@Le-Fleurrr commented on GitHub (Nov 17, 2024): Huh, okay thanks! Im gonna close this issue now.
Author
Owner

@zadjii-msft commented on GitHub (Nov 17, 2024):

Wow I've never heard of PATHEXT getting messed up like that before. I'm so glad this got sorted out! Hopefully it should be helpful to future readers too

@zadjii-msft commented on GitHub (Nov 17, 2024): Wow I've never heard of `PATHEXT` getting messed up like that before. I'm so glad this got sorted out! Hopefully it should be helpful to future readers too
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22558