关于CreateProcess函数空格或者中文问题
关于CreateProcess函数空格或者中文问题
红色的地方 我把保存成bat 就可以执行,直接用在命令里就是执行没效果,执行提示成功了,但是没效果
TCHAR* lpCmdLine = (LPTSTR)((LPCTSTR)strCmd);
strCmd = L"\"c:\\Documents and Settings\\hp\\桌面\\projects\\tlhq\\Debug\\mysqldump.exe\" ip -u -p ...信息" ;
STARTUPINFO si;
PROCESS_INFORMATION pi;
AfxMessageBox(lpCmdLine);
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
si.dwFlags |= STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
ZeroMemory( &pi, sizeof(pi) );
if(!CreateProcess(NULL,lpCmdLine,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi))
{
CString strDbg = _T("");
strDbg.Format(_T("CreateProcess Failed code : %d"),GetLastError());
//MessageBox(strDbg,_T("错误信息提示"),MB_OK);
return;
}
// Wait until child process exits.
WaitForSingleObject( pi.hProcess, INFINITE );
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
thread
[解决办法]
把路径换成这样试试
c:\\Docume~1\\hp\\桌面\\projects\\tlhq\\Debug\\mysqldump.exe
[解决办法]
TCHAR* lpCmdLine = _T("\"c:\\Documents and Settings\\hp\\桌面\\projects\\tlhq\\Debug\\mysqldump.exe\" ip -u -p ...信息");