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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.