The command you are using now will end up passing all of the items after the path to your program (starting with AppDirectory
) as arguments to your program when it is executed. Obviously that is not the behaviour that you want.
To establish parameters that are meaningful to nssm
you must run a separate nssm set
command for each parameter. In this case you would use this command to create the service and define the path to your program:
nssm install MDHIS_WebClient "%MDHIS2_HOME%/MDHIS_WebClient.cmd"
followed by this series of commands to establish the various parameters:
nssm set MDHIS_WebClient AppDirectory %MDHIS2_HOME%
nssm set MDHIS_WebClient DisplayName MDHIS_WebClient
nssm set MDHIS_WebClient Start SERVICE_AUTO_START
nssm set MDHIS_WebClient DependOnService MSSQLSERVER
nssm set MDHIS_WebClient AppNoConsole 1
nssm set MDHIS_WebClient AppStopMethodConsole 30000
To be safe, I would move the Start
parameter to the end of that series in order to prevent the possibility of nssm
launching the service before the remaining parameters (DependOnService
, AppNoConsole
and AppStopMethodConsole
) have been established.