util: Fix `failed to load env variables` on Windows when users have custom terminal shell args (#51787)

Closes #46933 

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] NO UI CHANGES


Release Notes:
- Fixed `Failed to load shell environment` errors on Windows when users
have custom terminal shell arguments configured (e.g., cmd.exe with `/k
echo Hello` or similar startup commands)
4eb7ae8108Amaan committed on 4/2/2026, 6:39:19 AM· committed by GitHubparentffbfff3
1 file changedLine totals unavailable