Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Set environment variable for one time system command windows

by BrowserUk (Pope)
on Mar 27, 2013 at 19:10 UTC ( #1025791=note: print w/ replies, xml ) Need Help??


in reply to Set environment variable for one time system command windows

The problem is that the variable substitution %test% is done before the command is executed. Ie. the variable in the echo is expanded before the set is exectuted.

However, if the second command is an executable rather than a built-in command, the variable is set when the executable runs:

C:\test>set test= & perl -E"system q[set test=fred & perl -E\"say $ENV +{test}\"]" fred

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re: Set environment variable for one time system command windows
Download Code
Re^2: Set environment variable for one time system command windows
by rmahin (Beadle) on Mar 27, 2013 at 19:57 UTC
    Well damn haha, just assumed that since the echo wasn't working the variable was not getting set. Thanks for clarifying.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1025791]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (14)
As of 2014-08-01 17:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (33 votes), past polls