Login | |
|
 |
RE: Passing Variables Between Scripts - Is it possible? - 4/30/2008 4:09:09 AM
|
|
 |
|
| |
ebgreen
Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
|
Well, it sort of depends on how you implement the Powershell script. Powershell supports command line parameters for the script so the easiest way is to just run the PS script and pass the values in at the command line.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Passing Variables Between Scripts - Is it possible? - 4/30/2008 7:12:06 AM
|
|
 |
|
| |
ebgreen
Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
|
Well the first thing to do is to write the PS to take command line parameters. In the process of testing that you will determine exactly what the command line to run the script needs to be structured like.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Passing Variables Between Scripts - Is it possible? - 4/30/2008 7:26:54 AM
|
|
 |
|
| |
ebgreen
Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
|
Make a .ps1 file with just this line in it: $args Let's say that you called it C:\Temp\Test.ps1 From a regular DOS prompt run this: powershell -command "C:\Temp\test.ps1 foo bar" The foo and bar are command line parameters to the PS script.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Passing Variables Between Scripts - Is it possible? - 5/1/2008 12:25:52 AM
|
|
 |
|
| |
ebgreen
Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
|
Call the script like this: powershell -command "C:\Temp\test.ps1 USER PASS" Then in the script do this: $user = $args[0]; $pass = $args[1]; Write-Host "The user is $user and the password is $pass";
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
|
|