Windows build number: Microsoft Windows NT 10.0.18363.0
Windows Terminal version: Version: 0.7.3451.0
A program named "C:\Program.exe" by myself
Here is the source code of C:\Program.exe
#include <windows.h>
int WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd)
{
MessageBox(NULL, "C:\\Program.exe Executed!", "Bug", MB_OK);
return 0;
}
my profile
{
"guid": "{58ad8b0c-3ef8-5f4d-bc6f-13e4c00f2530}",
"hidden": false,
"name": "Debian",
"fontFace": "绛夎窛鏇寸罕榛戜綋 SC",
"source": "Windows.Terminal.Wsl"
},
rename the exe to "Program.exe" and place it at C:\ then run Windows Terminal
Windows Terminal starts normally
C:\Program.exe is executed. And after it exits, Windows Terminal exit with an error

Happens when starting WSL and 'C:\Program.exe' exists.
It does not matter which exe is there, i created a copy of sqlite3.exe and named it c:\program.exe
Happens when starting WSL and 'C:\Program.exe' exists.It does not matter which exe is there, i created a copy of sqlite3.exe and named it c:\program.exe
This is a really old bug that have existed in
Windows for a long time. Not only windows terminal but also many other softwares are affected by this :(
the cause is the space in the folder name "Program Files". if the path is not quoted , some apis(such as CreateProcess) cannot deal with it very well.
For example,for C:\Program Files\Example Dir\Exe File.exe, it will try these following paths and the following contents is passed to as arguments. so if a program named "C:\Program.exe" exists, it will executed instead of the proper one.
#include <windows.h>
char str[1000];
int WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd
)
{
MessageBox(NULL, lpCmdLine, "Bug", MB_OK);
return 0;
}
try this and ..
include
char str[1000];
int WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd
)
{
MessageBox(NULL, lpCmdLine, "Bug", MB_OK);
return 0;
}try this and ..
This is much better than the Chinese?? pictures.
Who can read Chinees today? (not many @microsoft.com I guess... 馃榿)
If I'm reading this thread correctly, this sounds like we'll need to make sure to properly escape the path to conhost.exe in CreatePseudoConsole implementation. Thanks for finding this and investigating!
If you have a qualified path, you should be using the lpApplicationName parameter of CreateProcessW instead of searching the command line. But the image path in lpCommandLine should still be quoted properly for applications that parse their command line and expect the command to be parsed as argv[0]. Of course, it can just be "conhost.exe" in the command line if this executable, which you control, doesn't try to find the executable file via argv[0] (yuck).
:tada:This issue was addressed in #4172, which has now been successfully released as Windows Terminal Preview v0.8.10261.0.:tada:
Handy links:
Most helpful comment
try this and ..
