Hello,

I am working on a simple script that calls a .cmd file on a remote share. Right now it looks like this:

CreateProcess(
NULL,
commandLine,
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&si,
&pi)

the value of commandLine is "\\server\share\script"

Out on server\share the script is actually a .cmd file. So if I call it directly from the command line by typing '\\server\share\script <enter>' the script will execute. However when using CreateProcess it returns error code 2 (cannot find file specified).

As I understand, this is because CreateProcess assumes .exe extension if none is given. Is there a way for me to make it assume .cmd? Or is there a wildcard way to do it?

The problem is we have both .exe and .cmd files out there on the share so rather than force the user to know which it is I would like to be able to just give the name of the file to execute and my program will figure it out from there.

Thanks,
Ian