Re: pass parameters between Delphi app and batch file


Posted by Rick Ashford on May 05, 2000 at 00:41:21:

In Reply to: pass parameters between Delphi app and batch file posted by Stefan Loeners on April 29, 2000 at 20:38:10:

This is pretty easy. On your ShellExecute, the first parameter after your call to the batch file, which you currently have set to 'nil', is the parameter area. Just set the 'nil' to 'PChar('Parameter')'.

: How to pass parameters from an application to a batch file?
: This DLL (taken from the demos) keeps track of all folder operations : deletions, moves, copies, renames, puts the result in a log file and sends a Novell Netware broadcast message to a recipient specified in a batch file.
: Here is the last part :
: // write data to file and close
: Writeln(F, DateToStr(Date) + '-'+ TimeToStr(Time)+ ' - ' + Operation + ' Folder ' +PszSrcFile + ' ' + Rslt);
: ......
: // launch c:\copyhook.bat: sends broadcast message ShellExecute(0, 'open', PChar('c:\copyhook.bat'), nil, nil, SW_HIDE);

: I would like to pass the following parameters to the batch file : PszSrcFile (the folder on which the operation was performed), Operation (delete, move, rename or copy), Rslt (confirmed or attempted, depending on the choice made by user)
: The code of the batch file copyhook.bat looks like this :
: send "... attempted an illegal folder operation" MY_SERVER/MY_ID /B




Related Articles and Replies: