Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DeskTop folder, All Users

Status
Not open for further replies.
Apr 27, 1999
705
0
0
US

Hi,

Does anyone known how to enumerate through special folders, specifically "Desktop" and "AllUsersDesktop"?

Thanks,

fenghsui_1998
 
Use the WScript.Shell object to get the special folder and the File Scripting Object to enumerate the files:

'enumerate Desktop
Set objShell = WScript.CreateObject("WScript.Shell")

'change Desktop to AllUsersDesktop to get Users desktop
strDesktop = objShell.SpecialFolders("Desktop")

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strDesktop)

For Each objFile In objFolder.Files
Wscript.Echo objFile.Path
Next

Regards,

Stein Borge
Author of: Managing Enterprise Systems with the Windows Script Host
Over 800 pages of practical solutions oriented material, providing
detailed coverage of WSH 5.6, WMI,
ADSI, ADO, CDO, FSO and much more.
sb@nyetspam.enterprisewsh.com <- remove nyetspam when E-mailing
 
steinb,

Thanks for the code. I was searching for a specific file using FileSystem Object but did not know about the .LNK file type on the end.

Thanks! Cheers,
fengshui_1998
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top