CreateProcess and parameters

L

Leif Eirik Olsen

Hi,

I have the following code to execute a cab installation on my device. Now I
would like to add the "/noaskdest" parameter to the call, but cannot get it
to function.

This code works:
ProcessInfo pi;
String progPath = @"\Windows\wceload.exe";
String destAPP = @"\temp\tempAPP.cab";

if ( !CreateProcess(progPath, destApp, pi) )
MessageBox.Show("Failed! System error = " + GetLastError().ToString());

#1 This compiles, but the destApp Cab is not executed
if ( !CreateProcess(progPath + " /noaskdest", destApp, pi) )
MessageBox.Show("Failed! System error = " + GetLastError().ToString());

#2 This compiles, but the destApp Cab is not executed
if ( !CreateProcess(progPath", "/noaskdest " + destApp, pi) )
MessageBox.Show("Failed! System error = " + GetLastError().ToString());

So my question is: where to put the "/noaskdest" parameter in a construct
like this?

Thank you,
Leo
 
P

Paul G. Tobey [eMVP]

Well, you want to change the command line, not the program you're running!
destAPP is the wrong name for that parameter; commandLine would be a
more-suitable name. Modify that parameter and I think you'll find it
working.

Paul T.
 
S

Simon Hart [MVP]

Try someething like the following:

var startInfo = new ProcessStartInfo(@"\Windows\wceload.exe",
"/noaskdest " + "\"" + destAPP + "\" ");
var process = new Process();
process.StartInfo = startInfo;
process.Start();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top