WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Variables and Parameters

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

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 too
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.

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:   W13918
Filename:   Passing Variables Between WBT EXEs.txt
File Created: 1999:04:15:16:57:16
Last Updated: 1999:04:15:16:57:16