Getting output from command prompt

  • Thread starter Thread starter jal1219
  • Start date Start date
J

jal1219

Guest
I have an external executable that runs from a DOS shell. This program returns an identifcation string/number of a hardware lock connected to the parallel port of my PC. The string returned is something like 397d6fa38cefc6b5.

I would like to get this string from the DOS shell to populate a field in my form. I can call the executable using the Shell function, but this only returns the process id of the command prompt itself.

Any help is appreciated!
 
When you run the exe, does it also put the code on screen? - if so, you could pipe the output to a text file, then have a look inside that...

Mike
 
Thanks, I think this is what I will end up doing.
 
if you're going to do it that way, it's also a good idea to do this;

If Dir("c:\Mydir\Myfile.txt") <> "" Then Kill "c:\Mydir\Myfile.txt"
Shell "c:\Mydir\Myprog.exe>c:\Mydir\Myfile.txt", vbHide
While Dir("c:\Mydir\Myfile.txt") = ""
Wend
DoEvents

It just forces access to wait until the DOS app has finished creating the file, otherwise the code will continue to run in parallel and is likely to foul up.

HTH

Mike


[This message has been edited by Mike Gurman (edited 12-18-2000).]
 
Thanks! This also simplifies my checking if the file already exists.

Always learning...
Jon
 

Users who are viewing this thread

Back
Top Bottom