Re: Shell Functions and DOS executables



Hello,
Something along these lines may work for you.
(Make a reference in your project to the "Windows Script Host Object Model")


Dim wsh As IWshRuntimeLibrary.WshShell
Dim wshExec As IWshRuntimeLibrary.wshExec
Dim results as string
Set wsh = New WshShell
Set wshExec = wsh.Exec("c:\test.bat")
results = wshExec.StdOut.ReadAll




"VB_Newby" <VB_Newby@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:43c05173$0$72436$892e7fe2@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I'm running a DOS executable from a VB Shell function.

vCnvrtWFMResponse = Shell("cnvrtwfm -l " & InputPathFile,
vbNormalFocus) 'Call the app

The DOS executable converts a file from one format to another.

If it's successful, it looks like this (at the DOS prompt):
cnvrtwfm -l tek00001.wfm
Creating tek00001.dat

It it's unsuccessful, it looks like this (at the DOS prompt):
cnvrtwfm -l tek00001.wfm
Error Converting tek00001.wfm

As you can see, the DOS executable informs the user how things worked
out.

The Shell Function, of course, reports the taskID if it was
successful. However, it's definition of "successful" isn't the same
as my DOS executable. ;-)

Ideally, I'd like to retrieve the command line from the Shell
Function and interrogate the string myself. Another alternative is
to look of the converted file with a DIR Function. This seems kind
of crude.

How can I retrieve the command line output of a Shell'ed DOS
executable?

Any suggestions?


.



Relevant Pages

  • Parsing XML messgae in VB.Net
    ... Dim loginResponse As MSXML2.DOMDocument40 ... Private Function SendXmlRequest(ByRef xml As String) As MSXML2.DOMDocument40 ... ' Set known timeout values so we have more control over our request. ... ' that it was necessarily successful. ...
    (microsoft.public.dotnet.xml)
  • Parsing XML
    ... Dim loginResponse As MSXML2.DOMDocument40 ... Private Function SendXmlRequest(ByRef xml As String) As MSXML2.DOMDocument40 ... ' Set known timeout values so we have more control over our request. ... ' that it was necessarily successful. ...
    (microsoft.public.dotnet.xml)
  • Re: Handle Error in Called Sub
    ... If not, have it return True if successful, ... so that TImeLoop knows nothing about it. ... Dim sngStart As Single ... Dim Msg As String ...
    (microsoft.public.access.modulesdaovba)
  • Error Trapping Problem
    ... called function returns True if successful, and False if there are errors. ... Dim datStart As Date ... Dim Msg As String ... Password", vbCritical, "Build PAC Table Error" ...
    (microsoft.public.access.modulesdaovba)
  • Re: allow new data to be saved/shown in combo boxes
    ... Still not successful - I understand combo box name (it is ... >builder it will put the sub & end sub lines in for you ... >if the table is called ModelNo and the field is Model ... > Dim rs As DAO.Recordset ...
    (microsoft.public.access.forms)