Parse env:Path with PowerShell
The environment variable PATH (combined SYSTEM PATH and USER PATH) can be tricky to parse if you want to check for each folder it contains. This is due to the support of various formatting styles. For example, this is a valid PATH statement:
1 | C:WINDOWS;"C:Path with semicolon; in the middle";"E:Path with semicolon at the end;";;C:Program Files;<img class="alignright wp-image-26048 size-medium" src="https://www.catapultsystems.com/wp-content/uploads/20180130_162215-300x285.png" alt="" width="300" height="285" /> |
Notice the differences Folder with spaces Folder without spaces Folder with…