C++ CreateProcess()lpCurrentDirectory无效
我想启动一个进程(exe文件),如果我将完整路径附加到命令行(lpCommandLine param),一切正常,但如果我将lpCurrentDirectory设置为[STARTDIR],系统会显示:C++ CreateProcess()lpCurrentDirectory无效,c++,winapi,createprocess,C++,Winapi,Createprocess,我想启动一个进程(exe文件),如果我将完整路径附加到命令行(lpCommandLine param),一切正常,但如果我将lpCurrentDirectory设置为[STARTDIR],系统会显示: ERROR_FILE_NOT_FOUND 启动流程: CreateProcessA(NULL, // No module name (use command line) &command[0],
ERROR_FILE_NOT_FOUND
启动流程:
CreateProcessA(NULL, // No module name (use command line)
&command[0], // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
CREATE_NEW_CONSOLE, // No creation flags
NULL, // Use parent's environment block
[NULL] or [STARTDIR], // Use parent's starting directory
startupInfo, // Pointer to STARTUPINFO structure
processInfo) // Pointer to PROCESS_INFORMATION structure
->在此文件夹中有一些其他DLL和我要启动的exe
为什么这不起作用
谢谢 不,那不行。在启动过程中,新进程不会以该目录作为“当前”目录启动。相反,一旦进程启动,就会设置当前目录
如果希望进程在特定目录中启动,则需要使用或其或多或少的可移植变体之一(例如,
\u chdir
)。不,这不起作用。在启动过程中,新进程不会以该目录作为“当前”目录启动。相反,一旦进程启动,就会设置当前目录
如果希望进程在特定目录中启动,则需要使用或其或多或少的可移植变体之一(例如,
\u chdir
)。不,这不起作用。在启动过程中,新进程不会以该目录作为“当前”目录启动。相反,一旦进程启动,就会设置当前目录
如果希望进程在特定目录中启动,则需要使用或其或多或少的可移植变体之一(例如,
\u chdir
)。不,这不起作用。在启动过程中,新进程不会以该目录作为“当前”目录启动。相反,一旦进程启动,就会设置当前目录
如果希望进程在特定目录中启动,则需要使用或其或多或少的可移植变体之一(例如\u chdir
)