View Single Post
Old 08-15-2008   #1 (permalink)
pschmidt


 
 

Include another script, keep variables in included script?


I want to run or include a PS script from within another PS script. But
want the values set in the 2nd one to be available in the first one.

For example:
tmp.ps1----
$Test = "Here"
$There = "There"

echo "TEST: $test"
echo "There: $there"
------------------------

Now tmp2.ps1-------------
echo "TEST: " $Test

..\tmp.ps1

echo "TEST: " $Test
echo "There: " $there
-------------

When I run tmp2.ps1, I get:
Quote:

> .\tmp2.ps1
TEST:
TEST: Here
There: There
TEST:
There:
--------------------------

I'd like the values set in 'tmp' to be available in tmp2. How do I do this?

Thx,


My System SpecsSystem Spec