Jump to content

passing a value between Autoit3 and a .bat script


BrianH
 Share

Recommended Posts

Here is my simple hello.bat file

echo "hello"
pause
set I
pause
set IAMvalue="hello"
pause
set I
pause
exit 1

and my even simpler autoit3 script

EnvSet("IAMvalue","first")
$res=RunWait("HELLO.bat")
If $res=1 Then MsgBox(0,"", EnvGet("IAMvalue"))

The value "first" appears in the batch script which changes it to "hello"

but the msgbox displays the value "first", so the changed value does not survive the exit from the batch script.

Is there a way to pass a value from AutoIT3 to a batch script, and return a changed value ?

Link to comment
Share on other sites

To my small extent of knowledge this isnt possible using strictly variables. Maybe the STDRead/Write commands may help.

Also piping the output to a file and then working from there may be useful.

One other thing I feel would be useful to point out is that AutoIt should be able to perform any operation you are having performed by a .bat script.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

  • 2 weeks later...

To my small extent of knowledge this isnt possible using strictly variables. Maybe the STDRead/Write commands may help.

Also piping the output to a file and then working from there may be useful.

One other thing I feel would be useful to point out is that AutoIt should be able to perform any operation you are having performed by a .bat script.

JS

Thanks for the info. :o

I was calling someone else's .bat script but found it easier to rewrite in AutoIT3 than try to get the variable passing to work B)

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
 Share

  • Recently Browsing   0 members

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