%SystemRoot% in $Env:PATH?

I’ve got a few systems where remote PowerShell sessions can’t run EXEs from C:WindowsSystem32

When I looked into this, the only difference I can see is that the affected machines have paths like %SystemRoot%System32 in the PATH variable (instead of C:WindowsSystem32)

These systems were all built from RTM Windows Server 2016 images, so I’m not sure whether the use of %SystemRoot% within PATH is normal or not.

I’ve not seen this as an issue before, or in interactive PowerShell sessions, however I don’t call system executables from PowerShell very often so I can’t say if this has changed recently or not.

Is it best to turn these into strict paths? Can Powershell handle these substitutions in PATH at all?

EDIT: Fixed incorrect PATH – had %SystemRoot%Windows instead of just %SystemRoot%. The question still stands though!

submitted by /u/geggleau
[link] [comments]

Leave a Reply