WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Services

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

WinBatch Service Not Getting Parameters Passed by wntSvcStart

 Keywords: WinBatch Native Service .EXS Parameters 

Question:

I am hoping someone can assist me with what I hope is a simple question. I am using the wntSvcStart command to start a WinBatch service.

My command looks like this:

wntSvcStart(``, vServiceNm, 0, `test1 test2 test3`, ` `)
The call correctly starts the service however, the parameters seem to be lost in transit and never make it to the my service.

This is the first block of code in my service.

If IsDefined(param1) Then
vPar1 = param1
Else
vPar1 = `Param1 Not Defined`
End If
Message(`Param1`, vPar1)
The service always comes back with `Param1 Not Defined`

I am trying to understand what happens to the parameters from call to service. Did I miss something completely to allow the service to receive parameters?

Thank you for any guidance.

Answer:

Okay so it looks like the parameters are not getting translated into the WIL Param0, Param1, Param2, etc. variables. WinBatch services currently do not recognize startup parameters specified via the wntSvcStart function. This feature is on the list enhancement requests.

Note: If you place command line parameters in the registry 'imagepath' value for the service, they can apparently be accessed via the usual param0 through param9 variables inside the compiled service script.

SvcKeyName = `My Service Name`
root = @REGMACHINE
keyname = `SYSTEM\CurrentControlSet\Services\My Service Name`
item = `[imagepath]`
params = `"1" "2" "3"`

; Grab image path
imagepath = RegQueryExpSz( root, keyname:item)
; Include parameters in ImagePath
RegSetExpSz( root, keyname:item , `"`:imagepath:`" `:params )

Article ID:   W18005
Filename:   WinBatch Service Not Getting Parameters Passed by wntSvcStart.txt
File Created: 2009:06:04:09:15:26
Last Updated: 2009:06:04:09:15:26