CreateProcess okay, but DOS "window" doesn't close
Posted on 2000-04-05
Consider the following code:
SI : TStartUpInfo;
PI : TProcessInformation;
JARTempDir : string;
FillChar(SI, sizeof(SI), 0);
SI.cb := sizeof(SI);
JARTempDir := ExtractFilePath(Application.ExeName) + 'Temp';
CreateProcess(nil, pchar('C:\windows\command\deltree /Y ' + JARTempDir),
nil, nil, False, 0, nil, nil, SI, PI);
CreateProcess opens a DOS window and performs the deltree operation just fine. BUT, the window stays open.
How do I get the window to close when the deltree operation is complete?
Ideally, the DOS window would not be displayed at all.
Can someone who is well-versed on the CreateProcess function help me out here?
Is there an alternative to CreateProcess I can use to perform the deltree command? Perhaps some obscure Delphi file i/o command that can delete entire directories?
I know I've asked several questions here, but they all revolve around a common theme:
Performing "silent" command-line routines.