Skip to content

Problem debugging script with arguments if path to script contains spaces #1526

Closed
@tms320

Description

@tms320
  • Operating system name and version: Windows 10 x64
  • VS Code version: 1.27.1
  • PowerShell extension version: 1.8.4
code -v
1.27.1
5944e81f3c46a3938a82c701f96d7a59b074cfdc
ia32
$pseditor.EditorServicesVersion
Major  Minor  Build  Revision
1      8      4      0
code --list-extensions --show-versions
[createInstance] extensionManagementService depends on downloadService which is NOT registered.
ajshort.include-autocomplete@0.0.4
austin.code-gnu-global@0.2.2
bbenoist.togglehs@0.1.2
DotJoshJohnson.xml@2.3.2
felixfbecker.php-intellisense@2.3.5
formulahendry.auto-close-tag@0.5.6
formulahendry.auto-rename-tag@0.0.15
formulahendry.code-runner@0.9.4
jprestidge.theme-material-theme@1.0.1
mitaki28.vscode-clang@0.2.2
ms-vscode.cpptools@0.18.1
ms-vscode.csharp@1.16.0
ms-vscode.PowerShell@1.8.4
tht13.python@0.2.3
$PSVersionTable
Name                           Value
PSVersion                      5.1.17134.228
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17134.228
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

My powershell script "test.ps1" is located in "C:\Program Files (x86)\SomeFolder" folder.
If I start debug this script (F5 key) without command line arguments then everything works fine.
But if I start debug with command line argument (for example "param1") then I get error in powershell console (the message is in russian, sorry:)):

PS C:\Program Files (x86)\SomeFolder> . c:\Program` Files` (x86)\SomeFolder\test.ps1 param1
x86 : Имя "x86" не распознано как имя командлета, функции, файла сценария или выполняемой программы. Проверьте правильность написания имени, а также наличие и правильность пути, после чего повторите попыт
ку.
строка:1 знак:23
+ . c:\Program` Files` (x86)\SomeFolder\test ...
+                       ~~~
    + CategoryInfo          : ObjectNotFound: (x86:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

The translation of message to english:
x86: The name "x86" is not recognized as the name of the cmdlet, function, script file, or executable. Check the spelling of the name, as well as the presence and correctness of the path, and then try again
ku.
string: 1 character: 23

PS: I manually set command line argument via 'launch.json' file, for configuration 'PowerShell Launch Current File' as follows:

"args": ["param1"],

I also tried configuration 'PowerShell Launch Current File w/Args Prompt' - the problem remains.
If I move my script in folder without spaces in it's path (for example, "C:\Tmp\SomeFolder") then the problem disappears.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions