System Delphi

Title: Automatically start a service after using /Install or /Uniinstall switch
Question: Have you ever wished that the service would also start after installing the service not just install itself.
Answer:
// In the service unit add these statements before the 'end.' statement.
// To automatically start or stop the service during install or uninstall
// Tested only on Win2k and WinXP
// Change the 'myservice' in both WinExec statements to your own service name.
initialization
if (ParamCount = 1) and (CompareText('/uninstall',ParamStr(1))=0) then
begin
WinExec('cmd.exe /c net stop myservice',sw_hide);
sleep(3000);
end;
finalization
if (ParamCount = 1) and (CompareText('/Install',ParamStr(1))=0) then
WinExec('cmd.exe /c net start myservice',sw_hide);
end.