Skip to content

"Path" env variable gets stomped - windows #242373

Closed as not planned
Closed as not planned
@sharpencrag

Description

@sharpencrag

Type: Bug

Windows environment variables are supposed to be case-insensitive; however, if VS Code is launched from a shell where the Path variable is PATH instead of Path (such as one created by Python), Code's environment will create a second Path variable instead of inheriting PATH from the parent shell.

Steps:

  1. Create a shell that uses PATH instead of Path. The simplest way I found is to just create a shell from python:
# make_shell.py
import os
import subprocess

command = ["cmd", "/Q", "/K"]
print("Path is now PATH")
subprocess.call(command, shell=True, env=os.environ)
> python make_shell.py
Path is now PATH
> |
  1. Launch VS Code from this new shell

  2. Check your environment variables in the terminal

cmd: set path will show both PATH and Path -- modifications to PATH made upstream are not be reflected on Path

pwsh: trying to use dir env: will throw an error. Using write-host $env:path will show Path, and any changes to PATH upstream will be lost

Same effect occurs on Insider build. I don't know when exactly this behavior changed, but pre-configured shells are a pretty big piece of some developer tools we use

VS Code version: Code 1.97.2 (e54c774, 2025-02-12T23:20:35.343Z)
OS version: Windows_NT x64 10.0.26100
Modes:

System Info
Item Value
CPUs AMD Ryzen 9 7900X3D 12-Core Processor (24 x 4400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 63.73GB (44.66GB free)
Process Argv
Screen Reader no
VM 0%
Extensions disabled

Metadata

Metadata

Labels

info-neededIssue requires more information from poster

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions