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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Set environment variable for one time system command windows
by rmahin (Scribe) on Mar 27, 2013 at 19:57 UTC |