subst command not working through createProcess() - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

subst command not working through createProcess()

Helo all,

I try to do subst command to map a folder to a drive letter.

I achieved it through command line.

I did same thing via createProcess().

It returns non zero value but the folder not get mapped to that drive letter.

I am using windows2003 and NT.

The part of the code:

STARTUPINFO si;
PROCESS_INFORMATION pi;
int flag, err, i;

GetStartupInfo(&si);
/*
flag = 0;
flag = CREATE_NEW_CONSOLE;
flag = DETACHED_PROCESS;
flag = CREATE_NEW_PROCESS_GROUP;
*/
flag = 0;
DebugLogMessage1(cmd);
if(!CreateProcess(NULL, cmd, NULL, NULL, FALSE, flag,
NULL, NULL, &si, &pi)) {
err = GetLastError();
LogMsg(3, "RunCommand: Could not create process %s error=%d", cmd, err);
return;
}
The DebugLogMessage1(cmd); prints the value of cmd as subst R: C:PROGRA~1Syntegra

Please give me the things went wrong in the above program or in the windows settings.


Regards,
Naga
Sign In or Register to comment.