Running DOS Commands from Visual Basic Program 
Author Message
 Running DOS Commands from Visual Basic Program

I have searched the newsgroups and the web for an answer to the
following problem, and have not found an answer.
DIR /B >> C:\TEST1.TXT is a DOS command that will create a file named
TEST1.TXT in the C: Drive and append the  names of the directories and
files to the file.

How can I execute this command from Visual Basic.  Note:  I have seen
this answered several times by using Shell but this does not work! in
any syntex that I have seen.  Is there a simple one line solution, or
does it require a full subroutine to perform this action?



Fri, 20 Jul 2001 03:00:00 GMT  
 Running DOS Commands from Visual Basic Program
I don't know what syntax you tried for the Shell statement, but this one
works:

    Dim lRet As Long
    lRet = Shell("c:\command.com /c dir /b >> c:\text1.txt", 2)

Lee Weiner
weiner AT fuse DOT net



Quote:
>I have searched the newsgroups and the web for an answer to the
>following problem, and have not found an answer.
>DIR /B >> C:\TEST1.TXT is a DOS command that will create a file named
>TEST1.TXT in the C: Drive and append the  names of the directories and
>files to the file.

>How can I execute this command from Visual Basic.  Note:  I have seen
>this answered several times by using Shell but this does not work! in
>any syntex that I have seen.  Is there a simple one line solution, or
>does it require a full subroutine to perform this action?



Sat, 21 Jul 2001 03:00:00 GMT  
 Running DOS Commands from Visual Basic Program
Wow, It Works,  Thanks



Quote:
>I don't know what syntax you tried for the Shell statement, but this one
>works:

>    Dim lRet As Long
>    lRet = Shell("c:\command.com /c dir /b >> c:\text1.txt", 2)

>Lee Weiner
>weiner AT fuse DOT net



>>I have searched the newsgroups and the web for an answer to the
>>following problem, and have not found an answer.
>>DIR /B >> C:\TEST1.TXT is a DOS command that will create a file named
>>TEST1.TXT in the C: Drive and append the  names of the directories and
>>files to the file.

>>How can I execute this command from Visual Basic.  Note:  I have seen
>>this answered several times by using Shell but this does not work! in
>>any syntex that I have seen.  Is there a simple one line solution, or
>>does it require a full subroutine to perform this action?



Sun, 22 Jul 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Running Dos program in Visual Basic

2. Run a DOS command and Get output of a DOS command in VB5

3. Sequential run of DOS program via SHELL command

4. How To Run Another Program From Visual Basic Program

5. Visual Basic trying to send commands to dos and receive the output

6. HELP: Can i run dos executables in a Visual Basic Form???`

7. How to run my dos batch file fro visual basic

8. Running DOS Exe from Visual Basic

9. Shell to dos program - Visual Basic 6

10. Launching MS-DOS from with in a Visual Basic Program

11. Visual Basic and Command Line programs

 

 
Powered by phpBB® Forum Software