You are here:

Visual Basic/.txt file listing drive letters

Advertisement


Question
Is it possible to use vbs to create a .txt file listing the drive letters on a computer (no mapped drives or DVD drives, etc.)
All I have been able to find so far results in a message box...
Regards,

Answer
Yes, you need to enumerate the Drives collection and then just use standard File I/O to write your text file. It can be done. I teach writing text files in my VB tutorials. I don't have any sample code handy, but I'm sure you can find it with a Google search.

Let me know if you have any other questions or comments.

Also, be sure to visit my FREE Tips & Tricks Page at http://www.599cd.com/tips?key=AllExperts


Cordially,

Richard Rost
599CD Computer Training
http://www.599cd.com

P.S. Try one of my FREE tutorials at http://www.599cd.com/VB?key=AllExperts

P.P.S. I volunteer my time at AllExperts to help people, and I get a LOT of questions, so I can't take an hour to answer each question. If you need more DETAILED HELP, come to my TechHelp web site at http://www.599cd.com/TechHelp/AllExperts and I'll take as much time as you need to answer your question.  

Visual Basic

All Answers


Answers by Expert:


Ask Experts

Volunteer


Richard Rost

Expertise

I can answer any questions pertaining to Microsoft Visual Basic 6.0, Microsoft Access VBA, and the Visual Basic Language in general. I do NOT use VB.NET or VB 2005/08 much yet, so don't ask me any questions specific to those. Also, please feel free to check the Tips & Tricks section of my web site for VB tips.

Experience

I am the president of VBLearningZone.com and 599CD.com. I specialize in Microsoft Access and Visual Basic Tutorials. I have been teaching in the classroom since 1994, and online since 2002.

Education/Credentials
I am a self-taught VB expert. I have been building software for clients since the early 90s (and on my own since I was a child). You can see a sample of my Tutorials on my web site at 599CD.com

©2012 About.com, a part of The New York Times Company. All rights reserved.