Thanks, Sure, I could use setx, but this changes the environment variable on my maschine i.e. in every new shell I open, but not the current one. I guess that is not even possible using a normal e.g. C++ program.
Philipp -----Ursprüngliche Nachricht----- Von: Antoine Levy Lambert [mailto:[email protected]] Gesendet: Donnerstag, 18. März 2010 14:09 An: Ant Users List Betreff: Re: AW: Ant Environment Agreed with Jan. If you want to modify permanently the environment variables of Windows machines, one of the tools you can use is VBS. I think you will find articles about which API calls to use to do this in VBS. Ant can kick off a VBS script if you do <exec executable="wscript.exe"> <arg value="full path to vbs file"/> </exec> Regards, Antoine [email protected] wrote: > You are right: you cannot change the values from Ant. > You could use the "setx" system command, so NEW processes will get the new > values. > I dont know any possibility to change the environment for RUNNING processes. > Maybe via PowerShell, WindowsManagementInstrumentation, ... a la > for(Projess p : allRunningProcesses) > p.setEnv(key, newValue) > > > Jan > > >> -----Ursprüngliche Nachricht----- >> Von: Maurer Philipp [mailto:[email protected]] >> Gesendet: Donnerstag, 18. März 2010 08:18 >> An: [email protected] >> Betreff: Ant Environment >> >> Hello, >> >> >> >> I'd like to make ant modify my current shell environment on Windows >> maschines. >> >> >> Example: >> >> I'd like something like an 'ant set' (target 'set') that sets some >> 'foo=bar'. Calling that target should have the same effect >> than calling >> 'set foo=bar'. >> >> >> >> I tried some stuff: calling python scripts, generating and executing >> batch files, using setx, using cmd /C set. >> >> >> >> I think this is a more general problem and I think it is not >> possible at >> all (maybe someone could confirm this): >> >> All processes are forked or run in a separate shell and so in >> a separate >> environment. Changing this environment does not affect the environment >> from which I'm calling ant. >> >> >> >> Any ideas ? Windows-System calls ? Python calls ? >> >> >> >> Thanks, >> >> Philipp >> >> >> >> >> >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
