Code: Select all
run "cmd /c /q set MYVAR= & setx MYVAR PizzaMan",,0,0; Edit : I noticed in the one line of code I had 2 different variables, the use of "set" clears the variable if it already exists, and the setx establishes a new one.
Code: Select all
run "cmd /c /q set MYVAR= & setx MYVAR PizzaMan",,0,0; Code: Select all
$set = RunRet("cmd /c set");
$out = ""; $nr = 0;
ForEach ($line, $set, <crlf>) {
$var = GetToken($line, 1, "=");
$val = Eval("%$var%");
$out = "$out ".$nr++." $var = $val<tab>!! $line<crlf>";
}
Echo $out;
klownboy wrote:I was closing XY normally and then restarting XY using a numpad key I have assigned using AutoHotkey to start XY if not already active. When I restarted XY that manner even though it was closed, the newly established environmental variable does not show up either using your script or in XY's Environmental Variables. If I restart XY normally using a taskbar button with no AutoHotkey involvement, the new environmental variable shows up just fine...very odd.