Let's say this is what my Windows system PATH looks like:
C:\oracle\product\11.2.0\32bit\client_1\bin;C:\oracle\product\11.2.0\64bit\client_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
How would I remove that very first entry and add it to the end of the list? I know you can use setx for this but I would rather do this using PowerShell.
# Split the existing path into the 1st entry and the rest.
$first, $rest = $env:Path -split ';'
# Rebuild the path with the first entry appended.
$env:Path = ($rest + $first) -join ';'
# To make this change persistent for the current user,
# an extra step is needed:
[Environment]::SetEnvironmentVariable('Path', $env:Path, 'User')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With