//CMD 要执行的文件路径
//Visiable 是否显示窗口
Function WinExecExW(CMD:Pchar; Visiable:integer):DWORD;
var
StartupInfo : TStartupInfo;
ProcessInfo : TProcessInformation;
begin
FillChar( StartUpInfo, SizeOf(StartUpInfo), $00 );
StartUpInfo.dwFlags := STARTF_USESHOWWINDOW;
StartUpInfo.wShowWindow := SW_HIDE;
if CreateProcess( nil, CMD, nil, nil, {运行批处理文件}
False, IDLE_PRIORITY_CLASS, nil, nil, StartUpInfo,
ProcessInfo ) then
begin
WaitForSingleObject(Processinfo.hProcess,INFINITE);
GetExitCodeProcess(ProcessInfo.hProcess,Result);
CloseHandle( ProcessInfo.hThread );
CloseHandle( ProcessInfo.hProcess );
end;
end;