• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Grabbing text output of an exe

Wulluby

Member
Hi,


Does anyone have any pointers on how to grab the text output of an exe.


Scenario is that I have access to run an exe which when I run in my cmd window will give me my name. If someone else runs it from their machine it will display their name, seems perfect for putting into vba queries that pull info from databses and would bypass the need to login.


I'm guessing that Shell would be involved. I've been barking up

[pre]
Code:
Sub Test()

myVal = Shell("C:myfile.exe")
MsgBox myVal

End Sub
[/pre]
The MsgBox myVal comes back with not the expected result but a number which differs each time I run it. I figure this to be the unique task ID mentioned on the msdn site.


I don't have access to the inside of myfile.exe.


Any pointers would be appreciated.
 
Hi Wulluby,

Have you considered piping the output of the EXE to a file?

For example:

C:myfile.exe >> c:myoutput.txt


Then you can read the myoutput.txt file


(The ">>" appends the data to the output file. If you want to overwrite the file, use ">".)


Cheers,

Sajan.
 
Hi Sajan, thanks for the suggestion.


It crossed my mind but I am looking for a solution that is contained within the vba that won't leave text files lying about.
 
I think I might have misunderstood your idea of piping, if you mean altering the exe I don't have the access to do this.


If I can use the exe it has to be in its current form. It is something that is used by a couple of apps that allow users to query Sybase without having to enter their Sybase login details each time. I'm just wondering if I can utilise that functionality from within excel.
 
Hi, Wulluby!


Try with this:

http://resource-hacker.softonic.com/


Then open the .exe file, go to the treeview and expand StringTable entry. Then copy & paste.


Regards!
 
Hi JB,


Thanks for the pointer. I take it that's a decompiler? I will have a look at it and see if I can use it to work out the logic that is going on in the exe and see if I can apply it to the vba though I think the exe is using some kind of C language which is way over my head, not that I'm that solid on vba at the moment either :)


Cheers.
 
Hi, Wulluby!

It's not exactly a decompiler, but I think that it might help you achieve the goal of extracting text strings from an .exe file. If that's not what you asked for, I apologize and just ignore my suggestion.

Regards!
 
Hi JB, sorry for the delay. The storm before the calm at work, (holiday at end of the month).


Extracting text strings from an exe is what I am looking to do so I will have a good look at that, thanks.
 
Back
Top