|
-
Mar 7th, 2000, 09:26 PM
#1
Thread Starter
New Member
It seems as if this should be easy but I'm having no luck so far...
My company has a number of dos-based utilities which I would like to invoke in a VB(6) program, then redirect the output to a text file. I keep getting 'file not found' even though I have the correct path. To make sure our utilites weren't causing the problem, I tried the following lines, which also resulted in a 'file not found' error:
DosLine = "dir > d:\vbtest.tmp"
Holder = Shell(DosLine, vbMaximizedFocus)
It doesn't matter if vbtest.tmp already exists or not. Does anyone know a way to resolve this problem?
Ken Franklin
[email protected]
-
Mar 7th, 2000, 11:20 PM
#2
Member
Ken-
I've been looking into the same problem. I'm assuming that the redirection is giving you the problem. The solution that I came up with is to create or write to a batch file. They understand the redirection. So for example you could do this:
Code:
Dim sCmds As String
sCmds = "dir > d:\vbtest.tmp"
Open "c:\Dosline.bat" for Output as #1
Print#1,sCmds
Close#1
Then use the Shell() function to execute the .bat file
-
Mar 9th, 2000, 03:03 AM
#3
Thread Starter
New Member
That worked (Thanks, this project has been bugging me) but seems pretty clumsy.
Does anyone know more about why redirecting doesn't work at a Dos prompt without writing a batch file? Is there a better way to get results from Dos prompts?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|