OK - some joy, but some additional complexity.

I can keep the sub-process running as illulstrated above, allowing the sub-process to detect and perform a self-update and then simply exit.

The problem is that when the parent (dumb) process is terminated, the child (smart) process continues to run (which seems unusual to me). I modified the concept by passing the PID of the parent to the child. During each iteration of the loop, it checks to see if its parent is still running, and if it isn't, it dies.

Here's the code I'm using to test:
Dumb Service Manager (SVC.KIX):
 Code:
Break On
While 1
  Shell 'WKix32.exe service.kix $PID=' + @PID
Loop
"Smart" Service Code (SERVICE.KIX):
 Code:
Break On

If Not IsDeclared($PID)
  Global $PID
  'NoPid - cannot run!' ? 
  Quit 87
EndIf


While 1		; start of main service loop

  ; insure that our parent process is running - we die if it isn't
  $Rc = WmiProcessList($PID)
  If @ERROR Exit 0 EndIf


  ; test for service code update
  If Exist(@SCRIPTDIR + '\service.new')
    If Exist(@SCRIPTDIR + '\service.old')
      Del @SCRIPTDIR + '\service.old'
    EndIf
    Move @SCRIPTDIR + '\service.kix' @SCRIPTDIR + '\service.old'
    Move @SCRIPTDIR + '\service.new' @SCRIPTDIR + '\service.kix'
    'Updated!' ?
    Exit 0
  EndIf

  ; Identify who we are
  'Version 1' ?

  Sleep 2	; pretend we're doing serious work here...

Loop		; end of main service loop
without the WMIProcessList and TimeDiff UDFs.

To test the service self-update, create a copy of service.kix (service.txt) and edit the Version number.

First test - run SVC.KIX - second window should open with "VERSION 1" message repeating. Terminate SVC.KIX and the second window should close.

Second test - run SVC.KIX - second window should open with "VERSION 1" message repeating. Copy SERVICE.XXX to SERVICE.NEW. "Updating" message should flash, window should close, new window should open with "VERSION 2" message repeating. Folder should contain a SERVICE.OLD file.

The SERVICE.KIX needs the WMIProcessList and TimeDiff UDFs from my web site to run.



Glenn
_________________________
Actually I am a Rocket Scientist! \:D