Process.Start on CE.NET with built-in DOS commands

D

Damon Payne

This seems like it should be simple but is eluding me at the moment:

I'd like to use code to execute several built-in DOS commands on CE.NET
4.2; I can use Process.Start to run any EXE or cab file I've created
but not built-in commands like mkdir, del, etc.

ProcessStartInfo startInfo = new ProcessStartInfo("mkdir", "/storage
card/foo");
startInfo.UseShellExecute = false;
Process proc = Process.Start( startInfo );
System.IntPtr handle = proc.Handle;
proc.WaitForExit();
int code = proc.ExitCode;

proc.ExitCode throws an InvalidOperationException. My first idea is
that I need to include the entire path to "mkdir.com" or something like
that, but I do not see them.
 
D

Damon Payne

This is part of a remote update program that will do actions such as
download a CAB file, execute , then possibly remove files, move files
to a backup etc. I seems like dos commands should be executable but if
not I can certainly change the code.
 
G

Guest

They may be scriptable - I've never tried, but then you're dependent on the
command shell. I've done updaters myself and I provided a simple script
language to the user with a parser that uses the APIs directly. You get
better device coverage with not much more work.

-Chris
 
A

Alex Feinman [MVP]

What gives you an idea there is such executable as "mkdir"? On both Windows
and WIndows CE these are commands supported by cmd.exe, but not some
standalone executable.
To invoke mkdir in your example you will need tp specify the parameters as

ProcessStartInfo startInfo = new ProcessStartInfo("cmd.exe", "/c mkdir
\storage card\foo");
 
Top