Repository: vscode
Issue: When the environment variable is too long, it doesn't work in the vscode terminal
Labels: bug,windows,confirmation-pending,terminal-process


Type: <b>Bug</b>

Steps to Reproduce
Setting a Path environment variable longer than 2047 characters
Open vscode by double-clicking on the vscode icon or via the context menu.
Use any file in the Path in a vscode terminal, and pwsh/cmd will tell you that the file is not found.
Accessing the file directly in cmd and pwsh reveals that the file is accessible, unlike the behavior in vscode's built-in terminal.

This problem does not exist when vscode is started from the command line or when environment variables are reset in the terminal or when vscode configuration files are used to set environment variables for them

VS Code version: Code 1.88.1 (e170252f762678dec6ca2cc69aba1570769a5d39, 2024-04-10T17:41:02.734Z)
OS version: Windows_NT x64 10.0.22631
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|AMD Ryzen 5 5600H with Radeon Graphics          (12 x 3294)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: enabled_on<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_graphite: disabled_off<br>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled|
|Load (avg)|undefined|
|Memory (System)|13.87GB (5.75GB free)|
|Process Argv|--crash-reporter-id 646d2495-fd47-4909-9a40-345054c5c01b|
|Screen Reader|no|
|VM|67%|
</details><details><summary>Extensions (126)</summary>

Extension|Author (truncated)|Version
---|---|---
commit-message-editor|ada|0.25.0
codesnap|adp|1.3.4
Bookmarks|ale|13.5.0
vscode-sqlite|ale|0.14.1
classdiagram-ts|Ale|0.1.67
vscode-template-fsharp-highlight|alf|1.7.0
codegeex|AMi|2.7.2
vscode-color|ans|0.4.5
vscode-django|bat|1.15.0
toml|be5|0.6.0
git-easy|bib|1.11.0
markdown-mermaid|bie|1.22.0
mermaid-markdown-syntax-highlighting|bpr|1.6.1
vscode-tailwindcss|bra|0.10.5
npm-intellisense|chr|1.4.5
path-intellisense|chr|2.8.5
native-ascii-converter|cwa|1.0.9
vscode-office|cwe|3.3.2
vscode-markdownlint|Dav|0.54.0
ini-for-vscode|Dav|0.0.4
vscode-eslint|dba|2.4.4
docs-yaml|doc|1.0.1
githistory|don|0.6.20
python-environment-manager|don|1.2.4
python-extension-pack|don|1.7.0
es7-react-js-snippets|dsz|4.4.3
rust-syntax|dus|0.6.1
gitlens|eam|2024.4.1605
vscode-html-css|ecm|2.0.9
EditorConfig|Edi|0.16.4
prettier-vscode|esb|10.4.0
vscode-reveal|evi|4.3.3
magic-racket|evz|0.6.6
comment-anchors|Exo|1.10.4
abnf|for|1.0.0
auto-rename-tag|for|0.1.10
vscode-pull-request-github|Git|0.86.1
go|gol|0.41.2
vscode-drawio-insiders-build|hed|1.6.606
Ionide-fsharp|Ion|7.18.2
Sbt|itr|0.1.7
vscode-pnpm|Jac|0.0.3
vscode-computercraft|Jac|1.1.1
polacode-2019|jef|0.6.1
vscode-nuget-package-manager|jmr|1.1.6
svg|joc|1.5.3
ts-debug|kak|0.0.6
vsc-python-indent|Kev|1.18.0
vscode-clangd|llv|0.1.28
i18n-ally|lok|2.12.0
tga-image-preview|lun|1.0.0
workspace-cacheclean|Mam|0.0.2
json-to-ts|Mar|1.7.5
marp-vscode|mar|2.8.0
typst-preview|mgt|0.11.4
git-graph|mhu|1.30.0
vue-volar-extention-pack|Mis|2.0.7
moonbit-ai|moo|0.1.2
moonbit-lang|moo|0.1.289
language-gettext|mro|0.5.0
vscode-docker|ms-|1.29.0
vscode-language-pack-zh-hans|MS-|1.88.2024041009
csdevkit|ms-|1.5.12
csharp|ms-|2.24.17
dotnet-interactive-vscode|ms-|1.0.5208010
vscode-dotnet-pack|ms-|1.0.13
vscode-dotnet-runtime|ms-|2.0.3
vscodeintellicode-csharp|ms-|2.0.25
vscode-postgresql|ms-|0.3.0
autopep8|ms-|2024.0.0
debugpy|ms-|2024.5.11001012
isort|ms-|2023.13.10681007
python|ms-|2024.5.11021008
vscode-pylance|ms-|2024.4.101
jupyter|ms-|2024.3.1
jupyter-keymap|ms-|1.1.2
jupyter-renderers|ms-|1.0.17
vscode-jupyter-cell-tags|ms-|0.1.9
vscode-jupyter-slideshow|ms-|0.1.6
remote-containers|ms-|0.354.0
remote-wsl|ms-|0.88.0
azure-account|ms-|0.11.6
hexeditor|ms-|1.9.14
live-server|ms-|0.4.13
powershell|ms-|2024.2.0
vscode-github-issue-notebooks|ms-|0.0.130
vsliveshare|ms-|1.0.5918
autodocstring|njp|0.6.1
typst-lsp|nva|0.13.0
vscode-versionlens|pfl|1.9.2
csv-to-table|php|1.4.0
material-icon-theme|PKi|4.34.0
json-schema-2020-validation|pro|0.0.5
common-lisp|qin|1.2.10
sqlite-viewer|qwt|0.3.13
vscode-xml|red|0.26.1
vscode-yaml|red|1.14.0
LiveServer|rit|5.7.9
rust-analyzer|rus|0.4.1925
scala|sca|0.5.7
metals|sca|1.30.0
crates|ser|0.6.6
markdown-preview-enhanced|shd|0.8.13
vscode-scss-formatter|sib|3.0.0
svg-snippets|sid|1.0.1
lua|sum|3.7.4
sass-indented|syl|1.8.29
even-better-toml|tam|0.19.2
tauri-vscode|tau|0.2.6
xmake-vscode|tbo|2.3.3
msbuild-project-tools|tin|0.6.3
pdf|tom|1.2.2
typespec-vscode|typ|0.55.0
luna-paint|Tyr|0.16.0
errorlens|use|3.17.0
vscode-lldb|vad|1.10.0
intellicode-api-usage-examples|Vis|0.2.8
vscodeintellicode|Vis|1.3.1
vscodeintellicode-completions|Vis|2.0.0
vscode-mermaid-preview|vst|1.6.3
volar|Vue|2.0.10
faster-new|wen|1.5.2
jinja|who|0.0.8
JavaScriptSnippets|xab|1.8.0
viml|Xad|2.2.0
markdown-all-in-one|yzh|3.6.2

(1 theme extensions excluded)

</details><details>
<summary>A/B Experiments</summary>

```
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscorecescf:30445987
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:30899288
vscaat:30438848
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
h48ei257:31000450
pythontbext0:30879054
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
bf62j303:30959262
cppperfnew:31000557
d34g3935:30971562
fegfb526:30981948
bg6jg535:30979843
ccp2r6:30993542
dsvsc020:30976470
pythonait:31006305
gee8j676:31009558
dsvsc021:30996838
da93g388:31013173

```

</details>

<!-- generated by issue reporter -->