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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add My Documents desktop icon 1

Status
Not open for further replies.

bmquiroz

IS-IT--Management
Sep 26, 2003
207
US
Hello all,

I would like to add the My Documents folder icon to desktops that do not have it. Is there any way I could do this via VBScript? I don't want a shortcut, I want the actual icon placed on the desktop. Any help would be appreciated.

-Sip
 
Here you go. Code to turn it on and off. Enjoy

[script]
'==========================================================================
'
' NAME: ShowMyDocumentsFolder.vbs
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: ' DATE : 8/11/2004
'
' COMMENT: <comment>
'
'==========================================================================
On Error Resume Next

Dim path

Set WSHShell = Wscript.CreateObject("WScript.Shell")

'set the key path here. IF you don't end with a '\' then WSH assumes you are pathing to a value.
path = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\ShellFolder\"

'Display the My Documents Folder
WSHShell.RegWrite path & "Attributes","4194676","REG_DWORD"

'Hide the My Documents Folder
'WSHShell.RegWrite path & "Attributes","5343252","REG_DWORD"



[/script]

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Thanks Mark!

The code looks, havent tested it out yet though. I'll test it tonight and post the results.

Thanks again,

-Sip
 
The script works great! Thank you so much, definitely deserves a star!

-Sip
 
Or use somthing like this:

Code:
'RESTORE DEFAULT DESKTOP ICONS

Set WshShell = CreateObject ("WScript.Shell")

' HIDDEN OR VISIBLE
' 1 = HIDDEN
' 0 = VISIBLE 
' My Documents: "{450D8FBA-AD25-11D0-98A8-0800361B1103}"
' My Computer: "{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
' My Network Places: "{208D2C60-3AEA-1069-A2D7-08002B30309D}"
' Internet Explorer: "{871C5380-42A0-1069-A2EA-08002B30309D}"
' Recycle Bin: "{645FF040-5081-101B-9F08-00AA002F954E}"

sroot = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel\"
WshShell.RegWrite sroot & "{450D8FBA-AD25-11D0-98A8-0800361B1103}", "00000000", "REG_DWORD"
WshShell.RegWrite sroot & "{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "00000000", "REG_DWORD"
WshShell.RegWrite sroot & "{208D2C60-3AEA-1069-A2D7-08002B30309D}", "00000000", "REG_DWORD"
WshShell.RegWrite sroot & "{871C5380-42A0-1069-A2EA-08002B30309D}", "00000000", "REG_DWORD"
WshShell.RegWrite sroot & "{645FF040-5081-101B-9F08-00AA002F954E}", "00000001", "REG_DWORD"

sroot = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu\"
WshShell.RegWrite sroot & "{450D8FBA-AD25-11D0-98A8-0800361B1103}", "00000000", "REG_DWORD"
WshShell.RegWrite sroot & "{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "00000000", "REG_DWORD"
WshShell.RegWrite sroot & "{208D2C60-3AEA-1069-A2D7-08002B30309D}", "00000000", "REG_DWORD"
WshShell.RegWrite sroot & "{871C5380-42A0-1069-A2EA-08002B30309D}", "00000000", "REG_DWORD"
WshShell.RegWrite sroot & "{645FF040-5081-101B-9F08-00AA002F954E}", "00000001", "REG_DWORD"


'RESTORE NAMES DEFAULT DESKTOP ICONS

sroot = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID\"
WshShell.RegWrite sroot & "{450D8FBA-AD25-11D0-98A8-0800361B1103}\", "My Documents"
WshShell.RegWrite sroot & "{208D2C60-3AEA-1069-A2D7-08002B30309D}\", "My Network Places"
WshShell.RegWrite sroot & "{20D04FE0-3AEA-1069-A2D8-08002B30309D}\", ""
WshShell.RegWrite sroot & "{871C5380-42A0-1069-A2EA-08002B30309D}\", "Internet Explorer"
WshShell.RegWrite sroot & "{645FF040-5081-101B-9F08-00AA002F954E}\", "Recycle Bin"


' CHANGE "MY COMPUTER" TO "USERNAME ON COMPUTERNAME"

sroot = "HKEY_CLASSES_ROOT\CLSID\"
WshShell.RegWrite sroot & "{20D04FE0-3AEA-1069-A2D8-08002B30309D}\LocalizedString", "%USERNAME% on %COMPUTERNAME%", "REG_EXPAND_SZ"
WshShell.RegWrite sroot & "{20D04FE0-3AEA-1069-A2D8-08002B30309D}\LocalizedString.old", "@%SystemRoot%\system32\SHELL32.dll,-9216" , "REG_EXPAND_SZ"

Set WshShell = nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top