Transfer variable content in .bat file to variable in VB

I am trying to write VB code that loads a .bat file from VB, then according to the result of the batch file, other actions are taken from VB.

There is no problem to run the .bat file with VB.

My problem occurs when I need to select the content of a variable called status used in the .bat file and pass it to a variable in VB code.

Any ideas, suggestions are appreciated?

+3


source to share


2 answers


Try redirecting the results of the batch file to another file, for example ...

C:\>dir *.* > result.txt

      



If your VB app can look for (result.txt), open it by reading it after creation with a .bat file

+1


source


You cannot read the environment variables in the file package directly, as they are exclusively owned by that process.

Read the comments on this MSDN page for more details

The only solution is to make the batchfile store the result somewhere else where vb6 can read it, like in a file or in the registry.



I always like to create a section in the registry for my VB6 application and store my data there.

In a batch file, you can write to the registry via the command reg add

.

Take a look at fooobar.com/questions/134198 / ... for more team commentsreg add

0


source







All Articles