MCSE World
Everything you need for your Microsoft certifications...MCITP, MCTS, MCSE, Architect, Master and more!
 

Welcome to the MCSE World forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

1. We will remove new users that have 0 posts after 1 Month - so make sure you post a RELEVANT TO THE FORUM POST as soon as possible. Additionally after 18 months users with less than 5 posts will be removed.

2. The private message system is only available to members that have placed more than 3 valid posts - this is to prevent PM spamming.

3. The "Infocenter " along the top menu includes Book Reviews etc and is located in a separate section to the "General Forums" area.

- Administrator

Go Back   MCSE World > Windows Items and Issues > Windows Scripting
Login Register Site Rules Home Today's Posts Forums:  Home | List Donate Arcade InfoCenter Search Mark Forums Read

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 03-08-2005, 06:22 AM   #1
taid
Windows 7
 
taid's Avatar
 
Join Date: Feb 2004
Location: Burghfield Common, UK
Posts: 1,335
Thanks: 1
Thanked 3 Times in 3 Posts
List all folders on a windows host system

Code:
Const fsoForApend = 8 strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Dim objFSO Set objFSO = CreateObject("Scripting.FileSystemObject") 'Open the text file Dim objTextStream Set objTextStream = objFSO.OpenTextFile("folder-list.txt", fsoForApend) Set colFolders = objWMIService.ExecQuery("Select * from Win32_Directory") For Each objFolder in colFolders objTextStream.WriteLine objFolder.Name Next

Origional work done by Microsoft, modified by me for the output to file system.

as currently set you must create a file called folder-list.txt in the directory that you run the script in
__________________
"What fairy tales give the child is his first clear idea of the possible defeat of bogey. The baby has known the dragon intimately ever since he had an imagination. What the fairy tale provides for him is a St. George to kill the dragon." - GK Chesterton

MCSE: Security Specialist on Windows 2000, MCSA Security Specialist on Windows 2000 and 2003, Security+, Network+, A+

Currently working on Bachelor of Science: Computer Science
  Reply With Quote
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump



Powered by vBulletin Version 3.6.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright © 2003-2009, MCSE World.