I am working on Starting Windows Services using "SC START <Windows Servie="" Name="">". But i am getting following error when i execute this command from STAF
Exception in thread "main" stafclient.stafexception: You may have no more than 1 instances of option START
Can some one help me to resolve this issue.
Last edit: Ganesh Markande 2016-11-22
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My guess (since you didn't provide the STAF PROCESS START request that you submitted) is that you didn't use the right format for the COMMAND option value (or PARMS option value) . The COMMAND value contains the name of the START option so you need to either enclose the COMMAND value in double quotes or use the length limited format.
STAF local PROCESS START SHELL COMMAND "SC START serviceName" RETURNSTDOUT STDERRTOSTDOUT WAIT
Note that when the value of an option is the same as the name of the option (or another supported option), the value must be distinguished as such either by quoting the value or by using the length delimited format. For example, if NAME is the name of an option and you also want to specify NAME as the value of the option, you should specify either NAME "NAME" or NAME :4:NAME.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am working on Starting Windows Services using "SC START <Windows Servie="" Name="">". But i am getting following error when i execute this command from STAF
Exception in thread "main" stafclient.stafexception: You may have no more than 1 instances of option START
Can some one help me to resolve this issue.
Last edit: Ganesh Markande 2016-11-22
My guess (since you didn't provide the STAF PROCESS START request that you submitted) is that you didn't use the right format for the COMMAND option value (or PARMS option value) . The COMMAND value contains the name of the START option so you need to either enclose the COMMAND value in double quotes or use the length limited format.
See section "7.2 Option Value Formats" in the STAF User's Guide at http://staf.sourceforge.net/current/STAFUG.htm#HDROVFORM which says:
Note that when the value of an option is the same as the name of the option (or another supported option), the value must be distinguished as such either by quoting the value or by using the length delimited format. For example, if NAME is the name of an option and you also want to specify NAME as the value of the option, you should specify either NAME "NAME" or NAME :4:NAME.
thanks, This has resolved the issue. Thanks for valuale and quick response.