Jump to content

Execute multiple files on service start


Dennis

Recommended Posts

Hi,

 

I really didn't think this would be so hard to figure out, but it seems like creating a batch file that will open a cmd is no good. When creating a script that executes this command on service start, the service just "hangs" until the cmd window is closed manually. Anyone know a fix?

 

Kind regards

Link to comment
Share on other sites

  • 2 months later...

Close the CMD window on server stop and all other events with a batch script. Only close the cmd window that belongs to that user:

 

@echo off
   setlocal enableextensions disabledelayedexpansion

   set "executable=cmd.exe"
   set "user=TCAGame_Svc$[service.ServiceId]"

   for /f "tokens=2 delims=," %%a in ('
       tasklist /fi "imagename eq %executable%" /v /fo:csv /nh 2^>nul 
       ^| find /i "%user%"
   ') do taskkill /pid %%~a /f

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Who's Online   0 Members, 0 Anonymous, 157 Guests (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use