Prerequisites
Steps to reproduce
Description
When a Windows native C++ program is invoked from PowerShell with a single-quoted path ending in a backslash, an unexpected double quote (") is appended to the argument.
For example:
.\test.exe 'C:\Test Draw\3D\3D\50obj\'
The C++ program prints the following:
argv[0]:D:\**\test.exe
argv[1]:C:\Test Draw\3D\3D\50obj"
The expected value of argv[1] is:
C:\Test Draw\3D\3D\50obj\
but the actual value contains an unexpected trailing double quote:
C:\Test Draw\3D\3D\50obj"
This causes filesystem operations using the argument to fail. For example:
std::filesystem::exists(std::filesystem::path{argv[1]})
returns false because the resulting path is invalid.
Expected behavior
The trailing backslash should be preserved as part of the argument, without adding an extra double quote:
argv[1]:C:\Test Draw\3D\3D\50obj\
Expected behavior
C:\Test Draw\3D\3D\50obj\
Actual behavior
C:\Test Draw\3D\3D\50obj"
Error details
Environment data
Name Value
---- -----
PSVersion 5.1.19041.6456
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.6456
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Visuals
No response
Prerequisites
Steps to reproduce
Description
When a Windows native C++ program is invoked from PowerShell with a single-quoted path ending in a backslash, an unexpected double quote (
") is appended to the argument.For example:
The C++ program prints the following:
The expected value of
argv[1]is:but the actual value contains an unexpected trailing double quote:
This causes filesystem operations using the argument to fail. For example:
returns
falsebecause the resulting path is invalid.Expected behavior
The trailing backslash should be preserved as part of the argument, without adding an extra double quote:
Expected behavior
C:\Test Draw\3D\3D\50obj\Actual behavior
C:\Test Draw\3D\3D\50obj"Error details
Environment data
Visuals
No response