Skip to content

"Run C/C++ File" fails in PowerShell if path has spaces (missing & call operator) #14583

Description

@Lextyle92

Type: Bug

Environment

  • OS: Windows 10
  • VS Code Version: 1.128.0 / 1.129.0
  • C/C++ Extension Version: v1.32.2
  • Integrated Terminal Shell: PowerShell

Bug Description

A recent VS Code update introduced a regression in how paths containing spaces are sent to the integrated PowerShell terminal when using the "Run C/C++ File" button.

Instead of prepending the PowerShell call operator (&), the command is sent as a raw quoted string literal. As a result, PowerShell just echoes back the path as a string instead of executing the compiled binary.

Steps to Reproduce

  1. Create a workspace folder with spaces in its name (e.g., 00 - Test).
  2. Open the folder in VS Code and create a basic C file (main.c).
  3. Set PowerShell as the default integrated terminal profile.
  4. Click the "Run C/C++ File" play button in the top right corner.

Actual Behavior (Terminal Output)

PowerShell receives the quoted path without the & operator and evaluates it as a string literal:

PS C:\Users\Username\Documents\Development\Workspaces\C\00 - Test> "C:\Users\Username\Documents\Development\Workspaces\C\00 - Test\main.exe"
C:\Users\Username\Documents\Development\Workspaces\C\00 - Test\main.exe
PS C:\Users\Username\Documents\Development\Workspaces\C\00 - Test> 

The program is never executed.

Expected Behavior

The command sent to PowerShell should include the call operator (&) to evaluate the path as an executable command:

& "C:\Users\Username\Documents\Development\Workspaces\C\00 - Test\main.exe"

Additional Context

  • Workspaces without spaces in their path work perfectly.
  • Debug mode works perfectly because the extension correctly structures the arguments using the & operator to launch WindowsDebugLauncher.exe.

Extension version: 1.32.2
VS Code version: Code 1.129.0 (125df4672b8a6a34975303c6b0baa124e560a4f7, 2026-07-15T00:08:44Z)
OS version: Windows_NT x64 10.0.19045
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i5-6600 CPU @ 3.30GHz (4 x 3312)
GPU Status 2d_canvas: enabled
GPU0: VENDOR= 0x10de, DEVICE=0x1401 [NVIDIA GeForce GTX 960], DRIVER_VENDOR=NVIDIA, DRIVER_VERSION=32.0.15.8228 ACTIVE
GPU1: VENDOR= 0x8086, DEVICE=0x1912 [Intel(R) HD Graphics 530], DRIVER_VERSION=31.0.101.2111
GPU2: VENDOR= 0x10de, DEVICE=0x1401 [NVIDIA GeForce GTX 960], DRIVER_VERSION=32.0.15.8228
GPU3: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.19041.5794
Machine model name:
Machine model version:
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 23.89GB (19.37GB free)
Process Argv --crash-reporter-id b87b55e4-8836-49c4-baf6-faa406b533ce
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
6abeh943:31336334
envsactivate1:31551504
gh487529:31544284
cloudbuttont:31379625
3efgi100_wstrepl:31403338
ec5jj548:31422691
cp_cls_t_966_ss:31526232
4je02754:31466945
c3h7c220:31478652
cp_cls_c_1081:31454833
conptydll_true:31498968
e9c30283:31461165
test_treatment2:31471001
46204921:31447328
idci7584:31464702
e3e4d672:31494082
ei9d7968:31496641
chat:31457767
7e187181:31503455
ghj88844:31499326
ddid_c:31478207
hmra_i5g22:31518061
7df3h592:31512476
cp_cls_t_1082:31535311
logging_enabled_new:31498466
db5d2638:31499441
jb_cp_cls_t_632:31543129
748c7209:31512887
32d76977:31512328
ha629193:31508444
cdk-lw-on:31524445
f9bf7985:31543584
a1ije391_t:31540920
hgf2d445:31529595
8hfba999:31537718
prpt_srch:31518468
jbcp_cls_pctr_t:31531130
61138546:31518536
cp_intellij_t_nes:31548657
jf4hg949:31526829
h561g132:31533256
sessions_5:31532894
ihg5j128:31534457
f412h606:31551416
7g2b5551:31542111
7642ad28:31551796
fd5dc207:31551400

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdebuggerhelp wantedCan be fixed in the public (open source) repo.remotetasks/build/debugAn issue relating to tasks.json (e.g. build issues)

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions