#192938 - 2009-03-17 12:58 PM
How assign the result of SHELL command to a variable ?
|
yellowdog
Starting to like KiXtart
Registered: 2005-06-14
Posts: 102
|
Hello, I try in vain to initialize a kix variable with the content of a shell command. I want to set a variable with the result of:
Shell '%comspec% /c ping -n 1 "$Machine" | find /i "ttl"'
I tried also to use the WshPipe UDF, but in vain. Either with: $pingres=wshpipe('ping -n 1 "$Machine" | find /i "ttl"',1) OR $pingres=wshpipe('ping -n 1 "$Machine" | find /i "ttl"')
Thanks for a rapid answer
|
Top
|
|
|
|
#192940 - 2009-03-17 01:45 PM
Re: How assign the result of SHELL command to a variable ?
[Re: Lonkero]
|
yellowdog
Starting to like KiXtart
Registered: 2005-06-14
Posts: 102
|
With the comspec command, it's OK. $pingres=wshpipe('%comspec% /c ping -n 1 "$Machine" | find /i "ttl"',1)
BUT if I want to extract display (?) the $pingres variable, the following error occurs.
ERROR : Error in expression: this type of array not supported in expressions.! Script: F:\KIX Inventory\sep_machines.KIX Line : 28
Edited by yellowdog (2009-03-17 01:52 PM)
|
Top
|
|
|
|
#192942 - 2009-03-17 01:54 PM
Re: How assign the result of SHELL command to a variable ?
[Re: Lonkero]
|
yellowdog
Starting to like KiXtart
Registered: 2005-06-14
Posts: 102
|
$Machine is initialized correctly, it's extracted from a net view command. My problem now is, how do I extrcat the content of $pingres variable ?
|
Top
|
|
|
|
#192943 - 2009-03-17 02:32 PM
Re: How assign the result of SHELL command to a variable ?
[Re: yellowdog]
|
yellowdog
Starting to like KiXtart
Registered: 2005-06-14
Posts: 102
|
How do I get the content of $pingres=wshpipe('%comspec% /c ping -n 1 "$Machine" | find /i "ttl"',1) If I perform a ? $pingres an error occurs.
If there is an other way to transfer the result of a SHELL command to a local variable, let me know. It's rather urgent.
|
Top
|
|
|
|
#192945 - 2009-03-17 03:48 PM
Re: How assign the result of SHELL command to a variable ?
[Re: Allen]
|
yellowdog
Starting to like KiXtart
Registered: 2005-06-14
Posts: 102
|
OK Allen, it sounds good now.
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 138 anonymous users online.
|
|
|