ShellExecute隐式调用批处理并等待返回

  • Post author:
  • Post category:其他


SHELLEXECUTEINFO ShExecInfo = {0};

ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);

ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;

ShExecInfo.hwnd = NULL;

ShExecInfo.lpVerb = NULL;

ShExecInfo.lpFile =


“E://My Documents//Honeywell//Plan_Estimate//zip//extract.bat”;



ShExecInfo.lpParameters = “”;

ShExecInfo.lpDirectory =


“E://My Documents//Honeywell//Plan_Estimate//zip//”;



ShExecInfo.nShow =

SW_HIDE

;

ShExecInfo.hInstApp = NULL;


ShellExecuteEx(&ShExecInfo);

WaitForSingleObject(ShExecInfo.hProcess, INFINITE);

注:此处调用的批处理文件中最后须添加

exit

语句,否则

WaitForSingleObject

将永远不会返回!

———————————————————————————————————–



版权声明:本文为eulb原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。