A. PowerShell provides an easy solution through its test-path cmdlet. You can pass each entry from the PATH variable to the test-path cmdlet, as follows:

$env:path.split(";") | test-path
True
True
True
True
True
True
True

In this example, each entry is valid in the path. If you want to also list the path part, you can obtain two lines. The only difference is that you save an array of the components, then test each array element.

$envpart = $env:path.split(";")
foreach ($envbit in $envpart) \{$envbit; test-path $envbit\}
C:\Windows\System32\WindowsPowerShell\v1.0\
True
C:\Windows\system32
True
C:\Windows
True
C:\Windows\System32\Wbem
True
C:\Program Files\Diskeeper Corporation\Diskeeper\
True
C:\Windows\System32\WindowsPowerShell\v1.0\
True
C:\Program Files\Windows Imaging\
True