STARTUPINFO si;
PROCESS_INFORMATION pi;
memset(&si, 0, sizeof(si));
memset(&pi, 0, sizeof(pi));
si.cb = sizeof(si);
LPCWSTR procName =(LPCWSTR)"D:\test dir 1\Calc.exe";
LPWSTR procArg =(LPWSTR)"blacknull";
if(CreateProcess(procName,procArg,0,0,0,CREATE_DEFAULT_ERROR_MODE,0,0,&si,&pi))
{
//do some work
}
printf( "CreateProcess failed (%d).
", GetLastError());
system("Pause");
It keeps throwing Error(2)-> The System cannot find the file specified
.
I don't know what's wrong. I also tried to use "Calc.exe" which in the same Dir. but it's not working.
See Question&Answers more detail:os