Well, after some research, I abandoned the elegant approach and immediately sent directly to the registry.
To keep things simple, I did the following: I save the arguments that I wanted to pass in variables in my TService. Then I set the AfterInstall event to write directly to the registry (using the TRegistry object) the exact command line I wanted.
uses Registry; procedure MyService.AfterInstall(Sender: TObject) ; var reg:TRegistry; begin reg := TRegistry.Create; try reg.RootKey := 'HKEY_LOCAL_MACHINE'; if reg.OpenKey('SYSTEM\CurrentControlSet\Services\MyService', True) then begin reg.WriteExtendString ('ImagePath', ParamStr(0) + ' -some -arguments') ; reg.CloseKey; end; finally reg.Free; end; end;
Not the elegant solution I was looking for, but it does the job.
Thanks for the other answers!
Pablo venturino
source share