windows command line and spaces in display name = argument not parsed correctly

1,685 views
Skip to first unread message

dom...@gmail.com

unread,
Jul 8, 2013, 5:18:42 AM7/8/13
to topshelf...@googlegroups.com
Hi,
 
I would like to install a Windows service that host TopShelf interface.
 
I use the following command line :
 
MyService.exe install -displayname:"Js Service 9.0" -servicename:Js_Service_9_0 -instance:000
 
And I get the following error:
Topshelf.HostFactory Error: 0 : The service terminated abnormally, Topshelf.HostConfigurationException: The service was not properly configured:
[Failure] Command Line An unknown command-line option was found: ARGUMENT: Service
[Failure] Command Line An unknown command-line option was found: ARGUMENT: 9.0"

[Success] Name Js_Service_9_0
[Success] DisplayName "Js (Instance: 000)
[Success] Description Processes the job requests.
[Success] InstanceName 000
[Success] ServiceName Js_Service_9_0$000
   at Topshelf.Configurators.ValidateConfigurationResult.CompileResults(IEnumerable`1 results)
   at Topshelf.HostFactory.New(Action`1 configureCallback)
   at Topshelf.HostFactory.Run(Action`1 configureCallback)
 
As you can see it doesn't get the right value from command line even if I encapsuled the value between double quote chars.
 
I guess I'm doing something wrong, please tell me what.
 
Thanks

Dominique BOYER

unread,
Jul 8, 2013, 5:45:52 AM7/8/13
to topshelf...@googlegroups.com
I also tried that :
MyService.exe install "-displayname:Js Service 9.0" -servicename:Js_Service_9_0 -instance:000
 
But I get the same problem, note that the args[] collection is fine the main method, that means that the problem is inside TopShelf when parsing args :(

Dominique BOYER

unread,
Jul 8, 2013, 7:56:51 AM7/8/13
to topshelf...@googlegroups.com
Ok it works, it seems that I need to encapsulate all arguments between double quote.

Chris Patterson

unread,
Jul 8, 2013, 11:55:58 AM7/8/13
to topshelf...@googlegroups.com
The syntax is:

-displayname "My Display Name"
-displayName:DisplayNameWithoutSpaces

Those are the two ways that definitions are handled. 

Switches are:

--toggle --something --here




--
You received this message because you are subscribed to the Google Groups "topshelf-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topshelf-discu...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages