
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?