I'm really starting to see the power of .Net. Why oh why can't we get this added to Kix?

Anyway... Fire off a process and return the new processes PID.

break on
$RC=setoption("NoVarsInStrings","on")
$RC=setoption("NoMacrosInStrings","on")
$RC=setoption("WrapATEOL","on")
 
PSStartProcess("%systemroot%\system32\Calc.exe")

Function PSStartProcess($exe, optional $arguments, optional $PSObject) if $PSobject="" $PSObject=CreateObject("SAPIEN.ActiveXPoSH") endif if $PSObject.init(not 0) if exist($exe) if $arguments $PSObject.execute('$Process=[System.Diagnostics.Process]::Start("' + $exe + '","' + $arguments + '")') else $PSObject.execute('$Process=[System.Diagnostics.Process]::Start("' + $exe + '")') endif $PSStartProcess=$PSObject.getvalue('$Process.ID') else exit 2 endif endif endfunction


Edited by Allen (2010-09-15 07:33 PM)