Hi, i am tring to convert abc.exe /u "c:/programs/abc.dll" to powershell script can anybody explain how to do it.
how can i execute the *.exe having switches with parameters??
thanks..
Sunny
Hi, i am tring to convert abc.exe /u "c:/programs/abc.dll" to powershell script can anybody explain how to do it.
how can i execute the *.exe having switches with parameters??
thanks..
Sunny
If the normal syntax doesn't help out you could try:
$psi = New-Object System.Diagnostics.ProcessStartInfo "abc.exe"
$psi.Arguments = "/u c:/programs/abc.dll"
[System.Diagnostics.Process]::Start($psi)
See also: Documentation for System.Diagnostics.ProcessStartInfo.
It should be as straight forward as:
C:\PS> abc.exe /u c:/programs/abc.dll
However you can run into issues with quoting and other characters that get interpreted by PowerShell. Usually quouting an argument will suffice but if that still doesn't work you can use Start-Process in PowerShell 2.0 e.g.:
C:\PS> start-process abc.exe -arg @'
...
'@
If you have PowerShell Community Extensions installed you can use a utility called echoargs.exe to troubleshoot passing args to exe's. e.g.:
C:\PS> echoargs /u c:/programs/abc.dll
Arg 0 is </u>
Arg 1 is <c:/programs/abc.dll>
Echoargs display the arguments exactly as the EXE sees them.