WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: stevengraff on July 24, 2014, 08:46:51 AM

Title: Capture output from dos app
Post by: stevengraff on July 24, 2014, 08:46:51 AM
It seems that runShell and ShellExecute just return boolean success/failure results... is there some way I can capture the output of a dos app?

I have a program called md5sum.exe which accepts a parameter (a file name), and it outputs a text string. I could direct its output to a file if need be, but hoping to skip that intermediate step.

Title: Re: Capture output from dos app
Post by: snowsnowsnow on July 24, 2014, 09:08:38 AM
Search the tech db for:

W17213

There are others, but that's my personal favoriteââ,¬Â¦
Title: Re: Capture output from dos app
Post by: stevengraff on July 24, 2014, 09:29:42 AM
I like it!

But is there any way to make the dos app run completely silently, in the background? @Hidden and @icon don't entirely seem to work like I'd hope.
Title: Re: Capture output from dos app
Post by: Deana on July 24, 2014, 10:56:28 AM
Quote from: stevengraff on July 24, 2014, 09:29:42 AM
I like it!

But is there any way to make the dos app run completely silently, in the background? @Hidden and @icon don't entirely seem to work like I'd hope.

Unfortunately no not completely hidden. No way yet known to hide the DOS window from appearing on the screen except to perhaps have a "Keep on top" cover screen (i.e. BoxesUp and other box functions + IntControl(54,1,0,0,0)
Title: Re: Capture output from dos app
Post by: ....IFICantBYTE on July 24, 2014, 05:04:24 PM
Looking at your original needs from a different angle... if the DOS app you are running is returning an MD5 string of the filename you pass to it, then perhaps you can use the WB command:
FileDigest("path\filename.xxx","MD5",0)

instead of using the DOS exe at all?

Title: Re: Capture output from dos app
Post by: seckner on July 24, 2014, 06:36:11 PM
On the WB Tech support web site, under extenders, 3rd party extenders is one called Dos Capture Extender - I've used it with great success in capturing DOS output silently.  Hope this helps.
Title: Re: Capture output from dos app
Post by: stevengraff on July 25, 2014, 05:20:30 AM
Quote from: ....IFICantBYTE on July 24, 2014, 05:04:24 PM
Looking at your original needs from a different angle... if the DOS app you are running is returning an MD5 string of the filename you pass to it, then perhaps you can use the WB command:
FileDigest("path\filename.xxx","MD5",0)

instead of using the DOS exe at all?

Thanks... FileDigest completely solves my problem.
Title: Re: Capture output from dos app
Post by: stevengraff on July 25, 2014, 05:35:01 AM
Quote from: seckner on July 24, 2014, 06:36:11 PM
On the WB Tech support web site, under extenders, 3rd party extenders is one called Dos Capture Extender - I've used it with great success in capturing DOS output silently.  Hope this helps.

Thanks, just tried it... works like magic; what a gem!
Title: Re: Capture output from dos app
Post by: snowsnowsnow on July 25, 2014, 07:05:12 AM
FWIW, I can't find any "FileDigest" function in my docs.

Just out of curiosity, is "FileDigest" a new command [\*] or is it in some extender? [\**]

[\*] By "new", I mean "post 2006".
(heh heh - like in the C world, by "new", they often mean "C99" - 15 years ago)

[\**] There was some extender at one point (RC something or something like that) that computed these checksums, right?
Title: Re: Capture output from dos app
Post by: td on July 25, 2014, 08:05:48 AM
FileDigest was add to the WIL language with version 2007C  which was released  April 26, 2007.
Title: Re: Capture output from dos app
Post by: snowsnowsnow on July 25, 2014, 11:05:16 AM
Quote from: td on July 25, 2014, 08:05:48 AM
FileDigest was add to the WIL language with version 2007C  which was released  April 26, 2007.

Thanks.