I use the reg to solveļ¼
if(installer.isInstaller())
{
var pathText = "D:\\test"
var reg = installer.environmentVariable("SystemRoot") + "\\System32\\reg.exe";
var RegV="HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\SessionManager\\Environment"
component.addOperation("Execute", reg, "ADD", RegV , "/v", "pathText", "/t", "REG_SZ", "/d", pathText,"/f");
}
You can use the "REG ADD /?" in powershell to find the help.
Please note that this installer need call gainAdminRights():
function Component()
{
component.loaded.connect(this, this.installerLoaded);
installer.installationStarted.connect(this,Component.prototype.onInstallationStarted);
}
Component.prototype.onInstallationStarted = function()
{
installer.gainAdminRights();
installer.execute("cmd.exe", ["/c", "timeout " + "5"]);
}