T
Timo Meier
Hi, how can I ShellExecute a cab File with C#?
Peter Foot said:Use the CreateProcess function (A P/Invoke for this is included in the
opennetcf WinAPI library:-
http://www.opennetcf.org/WinApi.asp
Call the wceload.exe application and pass in the cab as an argument e.g.
Core.CreateProcess("wceload.exe", "yourcab.cab");
Jon Davis said:My thoughts as well, except that I've tried every combination of
slashes and used quotes and nothing worked. The same exact path
string works fine with a shell statement.
Funny enough though, if I move the file from the program files folder
to the windows folder, it worked fine. The only thing I can think of
is the space in "program files" is causing me problems, but putting
this in quotes should get around this problem shouldn't it?
No probs though, I've got a way around it (whether I'm crazy or not!).
Thanks a bunch!
"Paul G. Tobey [eMVP]" <[email protected]> wrote in messageThat sounds like you had either: a) no path or incorrect path to the target
cab file, or b) used \\ when \ was right or vice versa.
Paul T.
Jon Davis said:My thoughts as well, except that I've tried every combination of
slashes and used quotes and nothing worked. The same exact path
string works fine with a shell statement.
Funny enough though, if I move the file from the program files folder
to the windows folder, it worked fine. The only thing I can think of
is the space in "program files" is causing me problems, but putting
this in quotes should get around this problem shouldn't it?
No probs though, I've got a way around it (whether I'm crazy or not!).
Thanks a bunch!
"Paul G. Tobey [eMVP]" <[email protected]> wrote in messageThat sounds like you had either: a) no path or incorrect path to the target
cab file, or b) used \\ when \ was right or vice versa.
Paul T.
John Atkins said:You need to be very careful about spaces in folder and file names. I have
myRapi.CreateProcess(@"\Windows\wceload.exe", @"""" + fullName + @"""");
for executing a CAB. I'm not 100% certain this is required but I am certain
that something similar is required when creating shortcuts.
I wasted a long time on this yesterday. I eventually managed to see the
contents of a shortcut file (*.lnk) and found that without double quotes
around the name the path of the program to execute (in Program Files), the
lnk file would contain something like
"Program" Files\MyProg.exe"
John.
Jon Davis said:My thoughts as well, except that I've tried every combination of
slashes and used quotes and nothing worked. The same exact path
string works fine with a shell statement.
Funny enough though, if I move the file from the program files folder
to the windows folder, it worked fine. The only thing I can think of
is the space in "program files" is causing me problems, but putting
this in quotes should get around this problem shouldn't it?
No probs though, I've got a way around it (whether I'm crazy or not!).
Thanks a bunch!
"Paul G. Tobey [eMVP]" <[email protected]> wrote in messageThat sounds like you had either: a) no path or incorrect path to the target
cab file, or b) used \\ when \ was right or vice versa.
Paul T.
"Peter Foot [MVP]" <[email protected]> wrote in messageUse the CreateProcess function (A P/Invoke for this is included in the
opennetcf WinAPI library:-
http://www.opennetcf.org/WinApi.asp
Call the wceload.exe application and pass in the cab as an argument e.g.
Core.CreateProcess("wceload.exe", "yourcab.cab");
I ended up using shell instead of createprocess with the cab file
location/name as the parameter to wceload.exe because when I did the
create process with wceload.exe, I always got a message "Double-tap a
.cab file to install the application" instead of it actually
running/opening the cab file.
Of course, I was not using the opennetcf winapi library, so maybe I
had something else in my createprocess hosed up (except that other
items that I use create process work fine)
Jon said:You nailed it! I put the """"'s around it and it worked. I guess
that makes some since, I just couldn't see it before you pointed it
out.
Thanks for pointing that out to me
"John Atkins" <[email protected]> wrote in messageYou need to be very careful about spaces in folder and file names. I have
myRapi.CreateProcess(@"\Windows\wceload.exe", @"""" + fullName + @"""");
for executing a CAB. I'm not 100% certain this is required but I am certain
that something similar is required when creating shortcuts.
I wasted a long time on this yesterday. I eventually managed to see the
contents of a shortcut file (*.lnk) and found that without double quotes
around the name the path of the program to execute (in Program Files), the
lnk file would contain something like
"Program" Files\MyProg.exe"
John.
messageJon Davis said:My thoughts as well, except that I've tried every combination of
slashes and used quotes and nothing worked. The same exact path
string works fine with a shell statement.
Funny enough though, if I move the file from the program files folder
to the windows folder, it worked fine. The only thing I can think of
is the space in "program files" is causing me problems, but putting
this in quotes should get around this problem shouldn't it?
No probs though, I've got a way around it (whether I'm crazy or not!).
Thanks a bunch!
"Paul G. Tobey [eMVP]" <[email protected]> wrote in
to theThat sounds like you had either: a) no path or incorrect path
targetmessagecab file, or b) used \\ when \ was right or vice versa.
Paul T.
"Peter Foot [MVP]" <[email protected]> wrote in
included inUse the CreateProcess function (A P/Invoke for this is
theargumentopennetcf WinAPI library:-
http://www.opennetcf.org/WinApi.asp
Call the wceload.exe application and pass in the cab as an
e.g.Core.CreateProcess("wceload.exe", "yourcab.cab");
I ended up using shell instead of createprocess with the cab file
location/name as the parameter to wceload.exe because when I did the
create process with wceload.exe, I always got a message "Double-tap a
.cab file to install the application" instead of it actually
running/opening the cab file.Of course, I was not using the opennetcf winapi library, so maybe I
had something else in my createprocess hosed up (except that other
items that I use create process work fine)