Re: Shell Functions and DOS executables
- From: "Lance Wynn" <LanceWynn@xxxxxxxxxxxxxxxx>
- Date: Sat, 7 Jan 2006 19:16:44 -0700
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?
.
- Follow-Ups:
- Re: Shell Functions and DOS executables
- From: VB_Newby
- Re: Shell Functions and DOS executables
- References:
- Shell Functions and DOS executables
- From: VB_Newby
- Shell Functions and DOS executables
- Prev by Date: Re: Shell Functions and DOS executables
- Next by Date: Re: MSDN98, MSDN Library Visual Studio 6.0a
- Previous by thread: Re: Shell Functions and DOS executables
- Next by thread: Re: Shell Functions and DOS executables
- Index(es):
Relevant Pages
|