I have created windows service for tomcat server and it is running well but now I want to change service name without deleting it.
so is there any cmd\GUI steps to change service name?
windowswindows-services
I have created windows service for tomcat server and it is running well but now I want to change service name without deleting it.
so is there any cmd\GUI steps to change service name?
Best Answer
@bfhd's answer will work if you just want to change the Display Name (which is what's shown in the list in
Services.msc
, but is not the "real" service name (which is the name of the registry key containing the service information, and used in APIs likeOpenService
). The Remarks section of this MSDN article talks about service names vs. display names a bit more.Unfortunately, there's no official way to change a service's name. However, it is probably possible, if you absolutely must rename the service instead of just re-installing it under the new name for some reason. Do the following:
regedit.exe
(Registry Editor).HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
and find the subkey with your service's name.Services.exe
, the process that hosts the service control manager, won't see the change unless you do; attempts to start the renamed process (or otherwise interact with it at all, actually) will fail.I make no promise of this working. It's probably worth trying, though, if for some reason just reinstalling the service under a new name is so unacceptable.
If you must do this programmatically, there may exist a function
RegRenameKey
that can do the fourth step above for you. I stress may exist because, so far as I can tell, this function is completely unofficial; it's not in MSDN and there's precious little info about it. The only thing I found, other than the Windows headers (which have the prototype, and indicate that it's only on Vista - NT6.0 - and newer), is a Sysinternals forum post, which indicates that it calls an NT syscall (also undocumented). The function prototype, fromWinReg.h
, is