rmahin has asked for the wisdom of the Perl Monks concerning the following question:
Hi all, have a question that I hope is easy to answer.
I have multi-threaded server application that needs to set an environment variable, and then execute a command, but not set it for the rest of the threads. Here is an example that shows something similar to what I am doing,
use strict; use warnings; if($^O =~ /mswin32/i){ system("set test=hello && echo %test%"); }else{ system("test=hello; export test; echo \$test"); }
The unix portion of the code works flawlessly, the windows portion however just outputs '%test%'. I have tried using ';' and '&' in addition to the '&&' all with no success. is there a way to accomplish what I'm trying to do?
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Set environment variable for one time system command windows
by BrowserUk (Patriarch) on Mar 27, 2013 at 19:10 UTC | |
by rmahin (Scribe) on Mar 27, 2013 at 19:57 UTC | |
|
Re: Set environment variable for one time system command windows
by samwyse (Scribe) on Mar 27, 2013 at 19:55 UTC | |
by rmahin (Scribe) on Mar 27, 2013 at 19:59 UTC | |
|
Re: Set environment variable for one time system command windows
by aitap (Curate) on Mar 27, 2013 at 19:41 UTC |