简体   繁体   中英

Powershell script to call exe with 2 arguments

I have to create a script which basically calls exe with 2 arguments (DLL and XML).

sample code :

$app = 'C:\Test.exe'
$arg1 = 'C:\Test.dll'
$arg2 = 'C:\Test.xml'

&$app $arg1 $arg

But I get error even when I tried to execute one line on powershell.

Can someone get me the correct script?

You have to use Start-Process with the switch -ArgumentList You can also include -wait to get Powershell to wait for the process to exit before continuing with the script.

$options = "C:\test.dll C:\test.xml"
Start-Process -FilePath C:\exe.exe -ArgumentList $options

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM