Tough One - Return output from Dos Process without writing to file

A

Andibevan

Hi All,

Does anyone know of an approach that could be used to return the output of a
dos command without having to create a temporary file.

I am currently using the following dos command as part of a "Shell"
command:-

ping localhost > temp.txt

I can only find solutions that seem to only work in .net and I need
something for good old VBA

Thanks in advance

Andi
 
A

Andibevan

Tom - thanks for the suggestion but I don't actually want to be able to ping
I actually need to return output from a 3rd party app but thought my example
would be more helpful.

As another example how would I return the information produced by the
command DIR?
 
T

Tom Ogilvy

If your shelling to the app then I doubt there is a way to get anything back
except perhaps a result code which would most likely be zero.
 
A

Andibevan

Thanks John - That seems to be only for windows script - do you know of any
code that will work in VBA? Or can you use VB script within an excel file?
 
J

John.Greenan

You can use the windows script within vba. Just reference the windows script
host object model wshom.ocx - should be in the system32 directory.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top