Cómo ejecutar un comando y, a continuación, espere a que termine.
procedimiento ExecAndWait(línea de Comandos: cadena de CommandShow: Longint)
var
& nbsp & nbsp pi: TProcessInformation
& nbsp & nbsp si: TStartupInfo
begin
& nbsp & nbsp FillChar(si, sizeof(si), #0)
& nbsp & nbsp si.cb := sizeof(si)
& nbsp & nbsp si.dwFlags := STARTF_USESHOWWINDOW
& nbsp & nbsp si.wShowWindow := CommandShow
& nbsp & nbsp CreateProcess(nil, PChar(línea de Comandos), nil, nil, Falso, NORMAL_PRIORITY_CLASS, nil, nil, si, pi)
& nbsp & nbsp WaitForSingleObject(pi.hProcess, INFINITO)
& nbsp & nbsp CloseHandle(pi.hProcess)
& nbsp & nbsp CloseHandle(pi.hThread)
fin
Execandwait
Execandwait : Multi-millones de consejos para hacer su vida mas facil.
Como ejecutar un comando y, a continuacion, espere a que termine.
procedimiento ExecAndWait(linea de Comandos: cadena de CommandShow: Longint)
var
& nbsp & nbsp pi: TProcessInformation
& nbsp & nbsp si: TStartupInfo
begin
& nbsp & nbsp FillChar(si, sizeof(si), #0)
& nbsp & nbsp si.cb := sizeof(si)
& nbsp & nbsp si.dwFlags := STARTF_USESHOWWINDOW
& nbsp & nbsp si.wShowWindow := CommandShow
& nbsp & nbsp CreateProcess(nil, PChar(linea de Comandos), nil, nil, Falso, NORMAL_PRIORITY_CLASS, nil, nil, si, pi)
& nbsp & nbsp WaitForSingleObject(pi.hProcess, INFINITO)
& nbsp & nbsp CloseHandle(pi.hProcess)
& nbsp & nbsp CloseHandle(pi.hThread)
fin