Run Exe and Pass in Two Parameters

Started by Jeremy Whilde, January 28, 2014, 02:48:40 PM

Previous topic - Next topic

Jeremy Whilde

I am trying to run an executable and pass in two parameters or ID's, if I use the windows Start Run with:

Test.exe "123456789" "223344556"

The Test Exe runs fine and receives the parameters or ID's.

I have tried the following in WB but cannot get the Test.exe to receive the parameter ID's correctly:

;userID = "%Param1%"
userID = "123456789"

;IDs1 = StrCat( '"Text.exe", ', '"', userID, '"', ' "223344556"')
;Message("Params Test 1", IDs1)
;Run(IDs1)   ; Does not work

;Message("Params Test 2",  StrCat('"', userID, '"', ' "223344556"'))
;Run("Test.exe", StrCat('"', userID, '"', ' "223344556"')))      ; Does not work

;Message("Params Test 3",  '"Test.exe" "123456789" "223344556"')
;Run('"Test.exe" "123456789" "223344556"', "")   ; Does not work

; Direct Test
Run('"Test.exe" "123456789" "223344556"', '' )   ; Does not work

Any idea how to pass in the parameters to Test.exe correctly?

I have tried similar with RunShell but not managed to make this work either.

The Test.exe is written in AutoIt I have reluctantly used AutoIt as it needs to run cURL in a console, I would like to use WB
for this also but cannot get WB to run the cURL console.

This is the AutoIt that runs the cURL:

$agentID = $Cmdline[1]
$userID = $Cmdline[2]
Run( @ComSpec & " /c " & '"' & 'curl https://hostserver.com/api/v2/channels/voice/agents/' & '"' & $agentID & '"' & '/users/' & '"' & $userID & '"' & '/display.json -H "Content-Type: application/json" -v -u user:password -X POST -k' & '"', "", @SW_HIDE )

Any help or suggestions very welcome.

Thanks JW

Deana

Windows command line parameters need a set of double quotes around each paramater. Therefore you will need to use a different style of quote (such as a single quote) around your Run statement parameters:
Code (winbatch) Select
Run('Test.exe', '"123456789" "223344556"')
Deana F.
Technical Support
Wilson WindowWare Inc.