Passing Variables Between WBT EXE's
Keywords: Passing Variables
Question:
How do you exchange string variables between compiled WinBatch EXEs?Answer:
It's a bit of a pain, but it can be done. You could start the second EXE with parameters passed from the first.For example:
; wbt_1.exe RunWait("wbt_2.exe","%param1% %param2% %param3%") ; RunHideWait works tooAnother option is for one EXE to write a temp file containing the information you wish to exchange. The file can be read and deleted by the other EXE.For example:
; wbt_1.exe info=FileOpen("DaTemp.tmp","write") FileWrite(info,"Exchange this string.") FileClose(info) RunWait("wbt_2.exe","")And the second WinBatch script:;wbt_2.exe info=FileOpen("DaTemp.tmp","read") DaString=FileRead(info) FileClose(info) FileDelete("DaTemp.tmp")Another option is for one EXE to write a temp file containing the information you wish to exchange. The file can be read and deleted by the other EXE.I'd use IniWrite[Pvt] and IniRead[Pvt] instead, unless there's a lot of data involved. More efficient (go ahead, time it), and fewer lines of code.
Article ID: W13918Filename: Passing Variables Between WBT EXEs.txt