Podaz98 Posted September 16, 2020 Posted September 16, 2020 Hi all, I'm calling my script from the DOS. When I call the exe, I want to send also a value for a variable of my scrypt... which is the best pratice to follow? Many thanks for all in advance.
Guest Posted September 16, 2020 Posted September 16, 2020 (edited) Have a look at : https://www.autoitscript.com/autoit3/docs/intro/running.htm (Command Line Parameters) and/or search for $CMDLINE / $CMDLINERAW Edited September 16, 2020 by Musashi typo
Guest Posted September 16, 2020 Posted September 16, 2020 Example : Save Exitvalue.au3 and Call-Exitvalue.cmd to a directory of your choice. Compile Exitvalue.au3 and start the exe with the cmd file. Global $g_sValue, $g_sParam1 $g_sParam1 = "empty" If $CMDLINE[0] Then $g_sParam1 = $CMDLINE[1] EndIf $g_sValue = InputBox("Test", "enter a number between 1 and 99 : ", "0") MsgBox(4096, "", "Parameter = " & $g_sParam1 & @CRLF & "%ERRORLEVEL% = "& $g_sValue) Exit($g_sValue) @echo off echo starts Exe with Parameter and displays the Returnvalue echo. cd %~dp0 Exitvalue Parameter1 echo %ERRORLEVEL% pause Small hint : You can also predefine command line parameters within SciTE when developing your script (Press SHIFT F8). Call-Exitvalue.cmd Exitvalue.au3
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now