I am looking for a way to figure out any command line arguments to a service.
For a maintenance-free process, command-line arguments can be found in Windows Task Manager or programmatically using WMI, as shown in this post.
Unfortunately, these two solutions do not work for a Windows service that starts the ServiceController.Start (String [] args) method. Both of them show only the path of the executable on the command line, although some arguments have been passed.
- Can someone explain the difference between the two scenarios (service vs non-serving process)?
- Is there any way to figure out the windows service arguments?
UPDATE:
I also tried to create a simple service that simply logs any command line arguments that it has in the event log. I started it with "sc.exe start <my service> <arg1>" and confirmed that <arg1> was written to the event log. However, none of the solutions worked for me. What I saw is still just the path to the executable. My OS version is Windows Server 2008 R2 Service Pack 1 (SP1) x64 Enterprise.
source share