Jump to content

How to pass parameter to exe


Recommended Posts

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
Link to comment
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"

Link to comment
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.
Link to comment
Share on other sites

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
Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...