Fede E.
Fede E.

Reputation: 1918

NSSM: Can't edit a service I created

I am using NSSM to create a service, however, after creation I need to set some parameters, such as AppDirectory, AppNoConsole, etc.

I am able to create the service using the GUI, but I want to do it via cmd, for which I have a batch file that goes like this:

nssm install MyService "%Java_Exe_Path%" "-Xmx1024M -classpath \bin\start.jar;\lib\*;. com.myapp.class.subclass start"
nssm set MyService AppDirectory "%DIR%"
nssm set MyService AppNoConsole 1

Thing is I am getting errors that read:

Can't open service! OpenService(): Access is denied.

Or

OpenService(): The specified service does not exist as an installed service.

Notes: When I run the cmd file I get asked for admin rights (guessing to run the install), but to edit (set) I am not being requested permissions, neither I get asked permissions if I run the set command directly via commandline (also getting an error of access denied).

Can anyone help? Thanks!

Upvotes: 4

Views: 10482

Answers (1)

Fangxing
Fangxing

Reputation: 6135

Got the same problem, my solution is always run this script as an administrator:

How to request Administrator access inside a batch file

Upvotes: 0

Related Questions