TwebUpdate - restart .exe with parameters?

I've been using TWebupdate successfully for a long while. Now however I have a specific situation that I need help with.
My program can be run manually, in which case it first checks for updates and if found it downloads / installs / re-starts as usual.

However my progarm can also be run by the windows scheduler. In this case my program will also get passed a command line parameter to make my program do something special.
eg
   C:\program files\MyProg\MyProg.exe do_special_thing

How can I ensure that, in this special case only, when my program restarts after any update then it restarts having the same parameter passed the second time it starts as well so that it correctly does my special thing ?

With WebUpdate.OnSetAppParam you can pass the command line parameter that needs to be used for restarting the app after the update.



There are three versions of OnSetAppParam
(OnSetAppParams, OnSetAppParamAfter and OnSetAppParamBefore)
I guess you mean me to use the OnSetAppParams event but I'm not sure what I should do inside the event.

Do I need to say someting like

procedure TFrm_UpdateApplAndDB.WebUpdate1SetAppParams(Sender: TObject;  var AppParams: string);
begin
  AppParams := ParamStr(1);
end;

 

If you want that the param with which the app was started is reused when TWebUpdate restarts it, that is indeed what needs to be used in OnSetAppParam.

Thnaks Bruno, swift and helpful reply as always.