Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 828 Vote(s) - 3.48 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Setting Windows PowerShell environment variables

#21
These scripts are idempotent (can be run more than once).
They update both the Windows path and the current / future Powershell sessions:

# Permanently add path
``` powershell
$targetDir="c:\bin"
$oldPath = [System.Environment]::GetEnvironmentVariable("Path","Machine")
$oldPathArray=($oldPath) -split ';'
if(-Not($oldPathArray -Contains "$targetDir")) {
write-host "Adding $targetDir to Machine Path"
$newPath = "$oldPath;$targetDir" -replace ';+', ';'
[System.Environment]::SetEnvironmentVariable("Path",$newPath,"Machine")
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","User"),[System.Environment]::GetEnvironmentVariable("Path","Machine") -join ";"
}
write-host "Windows paths:"
($env:Path).Replace(';',"`n")
```

# Permanently remove path
``` powershell
$targetDir="c:\bin"
$oldPath = [System.Environment]::GetEnvironmentVariable("Path","Machine")
$oldPathArray=($oldPath) -split ';'
if($oldPathArray -Contains "$targetDir") {
write-host "Removing $targetDir from Machine path"
$newPathArray = $oldPathArray | Where-Object { $_ –ne "$targetDir" }
$newPath = $newPathArray -join ";"
[System.Environment]::SetEnvironmentVariable("Path",$newPath,"Machine")
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","User"),[System.Environment]::GetEnvironmentVariable("Path","Machine") -join ";"
}
write-host "Windows paths:"
($env:Path).Replace(';',"`n")
```
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through