output of a dos program

i want to execute a dos command in Visual Basic.The output of which I should be able to save in a text file.

I feel there should be some bloody API function which I am not getting in my my mind


thanks in advance
ninoo


ninooAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

VbmasterCommented:
command >bloodyfile.txt

This will direct all output to the 'bloodyfile.txt' file.
0
ninooAuthor Commented:
i want it in as API FUNCTIONS
0
JuiletteCommented:
want a lot for 1 point
0
Erick37Commented:
Some related reading:

"INFO: Redirection Issues on Windows 95 MS-DOS Applications"
http://support.microsoft.com/support/kb/articles/Q150/9/56.ASP

"Examples of Loading MS-DOS Directory Listing into an Array"
http://support.microsoft.com/support/kb/articles/Q41/4/47.ASP
0
MarktalbotCommented:
whats the point of api calls if vb already provides a comand to do this job called shell.To write the oput of the program just use >textfile.txt after the file. Shell has the format of
shell(command line,window stlye).This is the vb help file .

Shell

Runs an executable program and returns a Variant (Double) representing the program's task ID if successful, otherwise it returns zero.

Syntax

Shell(pathname[,windowstyle])

The Shell function syntax has these named arguments:

Part      Description
pathname      Required; Variant (String). Name of the program to execute and any required arguments or command-line switches; may include directory or folder and drive.
windowstyle      Optional. Variant (Integer) corresponding to the style of the window in which the program is to be run. If windowstyle is omitted, the program is started minimized with focus.
The windowstyle named argument has these values:

Constant      Value      Description
 
vbHide      0      Window is hidden and focus is passed to the hidden window.
vbNormalFocus      1      Window has focus and is restored to its original size and position.
vbMinimizedFocus      2      Window is displayed as an icon with focus.
vbMaximizedFocus      3      Window is maximized with focus.
vbNormalNoFocus      4      Window is restored to its most recent size and position. The currently active window remains active.
vbMinimizedNoFocus      6      Window is displayed as an icon. The currently active window remains active.
Remarks

If the Shell function successfully executes the named file, it returns the task ID of the started program. The task ID is a unique number that identifies the running program. If the Shell function can't start the named program, an error occurs. If you use the MacID function with Shell in Microsoft Windows, an error occurs.

Note   The Shell function runs other programs asynchronously. This means that a program started with Shell might not finish executing before the statements following the Shell function are executed.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.