Create Process and Parameter.
Posted on 2001-08-22
I was wondering if anyone knew how to execute a batch file with a paramater attached.
I can use the code below to just exe the batch file but when I try to add the parameter at the end (NAME).
It drops out.
Name := TEST;
FileToRun := C:\TEMP + 'RUN.BAT ' + NAME;
if CreateProcess(nil, PChar(FileToRun), nil,
nil, false, NORMAL_PRIORITY_CLASS, nil, nil,
startinfo, proc_info) <> False then
// The process has been successfully created so execute it and wait
// until it ends while still processing the form
false, INFINITE, (QS_POSTMESSAGE Or QS_SENDMESSAGE))
<> WAIT_OBJECT_0 do
// Process has finished. So close the window
// take out because dos window closes by itself