I've been going down a rabbit hole with how Powershell processes the PATH environment variable. I am developing a program that helps manage the PATH, and I recently discovered that it has issues when a path containing semicolons is added to the PATH.
According to this comment on Github](https://github.com/HorridModz/Flow.Launcher.Plugin.Add2Path/pull/8#issuecomment-2596593503%29 "github.com") by another user, Powershell interprets the PATH by splitting using the delimiter, which is a semicolon. However, it interprets quotes literally.
This is a problem, because adding a folder path that contains a semicolon PATH using Windows' environment variable editor (Edit the system environment variables -> Path -> Edit
) causes Windows to automatically wrap the required paths in quotes, breaking Powershell.
For example, the PATH value C:\Program Files (x86);"C:\;My Folder";C:\Program Files
is wrongly interpreted like this, since Powershell naively splits by semicolons:
C:\Program Files (x86) "C:\ My Folder" C:\Program Files
This behavior only occurs in Powershell, not Command Prompt. Here's a video demonstrating it: https://www.mediafire.com/file/aih2ky9fz07x5w0/powershellpathwithsemicolonsbug.mp4/file
Is this behavior a bug, or is it intentional? And is there any workaround?
***moved from Windows / Windows 10 / Files, folders, and storage***