I have a batch file and an application developed in delphi7. Both are working fine. I want to run the batch file when clicking a button. what can I do for that?
Thanks Nelson
Use ShellExecute which is declared in ShellAPI.
ShellExecute(
MainForm.Handle,
'open',
PChar(scriptfilename),
PChar(params),
PChar(workingdirectory),
SW_SHOW
);
CreateProcess you'd have to send it cmd.exe as the executable, and then whatever arguments are needed to run the script. Typically that would be /C scriptfilename.bat'cmd.exe /C scriptfilename.bat' as 'lpCommandLine' I've already tried it.. I'm using RunDosInMemo, it only shows an empty cmd window, and my app stops on until (Apprunning <> WAIT_TIMEOUT) loop till I close cmd manually, however the command runs OK from Run window. should I change anything in RunDosInMemo?