Set objFS = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
strCurrentDirectory = objShell.SpecialFolders("AllUsersDesktop")
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(strCurrentDirectory)
Set objFolderItem = objFolder.Self
strCurrentDirectory = objShell.SpecialFolders("AllUsersDesktop")
The script crashes on the last line
The error message is
Microsoft VBScript runtime error (59,
1) : Object doesn’t support this
property or method:
‘objShell.SpecialFolders’* script completed – exit code: 259 *
I used http://www.wisesoft.co.uk/scripts/vbscript_display_special_folder_locations.aspx as a reference.
When
ObjShellis aWScript.Shellyou can access its implementedSpecialFoldersbut you then reassign it to an instanceShell.Applicationwhich does not implementSpecialFolders, hence the error.retrieves the path, then:
fetches it as a shell item, for example after that:
would echo
"Desktop"