PDA

View Full Version : Appending to Windows PATH variable



tasdvl9
11-24-2015, 08:54 PM
Hello,

I've searched for an answer to this inquiry but came up empty.

Any links explaining how to append a directory path to a Windows 7 PATH environment variable
using a Basic MSI project?

Thank You.

SGSlavendea
11-30-2015, 05:44 AM
PS: (Check for path (in this case, C:\xampp\php) and add it to the system PATH, all users, system-wide)
Store in Binary table, Deferred Execution in System Context..

$PATH = [Environment]::GetEnvironmentVariable("PATH")
$xampp_path = "C:\xampp\php"
if( $PATH -notlike "*"+$xampp_path+"*" ){
[Environment]::SetEnvironmentVariable("PATH", "$PATH;$xampp_path", "Machine")
}