VBScript help?

Soldato
Joined
7 May 2004
Posts
5,503
Location
Naked and afraid
Hi guys, I've never had to do any scripting before.

I need to create a script that deletes a number of desktop icons, I've found the following Microsoft TechNet article ( http://www.microsoft.com/technet/scriptcenter/resources/qanda/mar07/hey0319.mspx ), I've copied and run the script but it doesn't work?

Naturally I renamed the file to delete (and created it) but nothing happens when I run the vb.

Any help/suggestions?

Thanks in advance.
 
The script does work but it's specifically written to return only shortcuts so unless what you're trying to delete is a shortcut then the line:

Set colItems = objWMIService.ExecQuery _
("Select * From Win32_ShortcutFile Where FileName = 'fred99'")

will return nothing. In the above fred99 is a shortcut to the file fred999.txt, both the file and the shortcut were on my desktop, running the script it finds the shortcut fred99 and deletes it.
 
Back
Top Bottom