Sign in to follow this  
Followers 0
Kris123

How to pass parameter to exe

13 posts in this topic

Deal All,

i compiled my script and made as an exe.

Now i want to pass a parameter to that exe and bassed on the value i want to make chnages in my exe.

it is like command line arguements. how can i do that. Please help...........

Share this post


Link to post
Share on other sites



Im sorry i could not find.

Please give some more details.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Step 1) Open the help file

Step 2) Open the "Search" tab

Step 3) Enter $CmdLine in the search box

Step 4) Press the enter key

Step 5) Choose the first result from the list that appears (Edit: You do this by double clicking the item)

Step 6) A page appears on your right, read it

Edited by Manadar

Share this post


Link to post
Share on other sites

Thanks i found the help.

But i have a doubt. currently i am running an exe in my script as follows.

Run(@ScriptDir & "\Wrong Format1.exe")

so how to pass arguements in that command and in the same way how to get those arguements in Wrong Format1.au3 and process.

Please help.

Share this post


Link to post
Share on other sites

You can do something like :

Run(@ScriptDir & "\Wrong Format1.exe param1 'some param info'")

in your wrong format1.exe

$CmdLineRaw equals... param1 "some param info"

$CmdLine[0] equals... 2

$CmdLine[1] equals... param1

$CmdLine[2] equals... "some param info"

Share this post


Link to post
Share on other sites

Thanks i found the help.

But i have a doubt. currently i am running an exe in my script as follows.

Run(@ScriptDir & "\Wrong Format1.exe")

so how to pass arguements in that command and in the same way how to get those arguements in Wrong Format1.au3 and process.

Please help.

You can pass arguments to the script if you run it from SciTE. Choose the view menu then parameters. You are limited to a maximum of 4 parameters though.

You can also use RUN and then you can have as many parameters as you like.

$AutoItProdexePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt","InstallDir");installDir for production
$AutoItBetaexePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt","betaInstallDir");installDir for production
$AutoItexePath = $AutoItBetaexePath;default to beta??

Run( '"' & $AutoItexePath & '\AutoIt3.exe" $ScriptFolder & "\Wrong Format1.au3" ' & $param1 & ' ' & $param2 & ' ' & $param3)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Dear all,

i tried by giving following way.... but is giving errors.

Run( '"' & $AutoItexePath & "\AutoIt3.exe" @ScriptDir & "\Wrong Format1.au3" & 10)

Please help.

Edited by Kris123

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

You need spaces. What you have now results into:

"C:\Program Files\AutoIt3\AutoIt3.exe\C:\Users\You\yourscript.au3\Wrong Format1.au310"

The error is caused by this:

Run( '"' & $AutoItexePath & "\AutoIt3.exe" @ScriptDir & "\Wrong Format1.au3" & 10)
; . . . . . . . . . . . . . . . . . . . . ^ no &
Edited by Manadar

Share this post


Link to post
Share on other sites

i tried by removing '&', but still same error.....syntax error.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0