Running a C# executable that requires parameters
i have c# executable need run within powershell script. has 3 parameters.
when execute inside of .bat file, looks this:
convertpptxtopdf.exe "m1-overview\slides\m 01-overview.pptx" "devws\overview\slides\m 01-overview_handouts.pdf" "handouts"
basically, take .pptx, convert pdf setup handout , save _handouts.pdf file.
i've been trying figure out how run , seems should able start '&' character , separate .exe , parameters '' , spaces this:
& 'convertpptxtopdf.exe' 'm1-overview\slides\m 01-overview.pptx' 'devws\overview\slides\m 01-overview_handouts.pdf' handouts'
however, not work, tells me cannot find positional parameter starts 'm1-overview... etc.
what correct syntax getting run?
thanks!
stom
hi,
try below code:
$cmd="c:\applications\exename.exe"
$arg1='m1-overview\slides\m 01-overview.pptx'
$arg2='devws\overview\slides\m 01-overview_handouts.pdf'
$arg3="handouts"
&
$cmd $arg1 $arg2 $arg3
regards,
yan li
cataleya li
technet community support
Windows Server > Windows PowerShell
Comments
Post a Comment