Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Oct 1, 1996

Redirecting DIR Command Output

Question:
How do I create the VB equivalent of the command below
DIR C:\ /S /B >MYFILE.LST
I need this routine for a program that keeps track of installed and removed files.

Answer:
Try:

Shell "COMMAND.COM /C DIR C:\ /S /B > MYFILE.LST"
That should do what you want it to. DIR is not a program...it is part of the command interpreter. Be aware that you can write a routine in straight VB code that will do this without shelling to DOS. Look in help for the Dir Function (I believe it's called Dir$ in VB3.0).
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date