Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'This script will discover available special folders in the current system and
- 'display their name and path. It will also list some known Windows version
- 'specific special folders which are available but are not yet made accessible
- 'in a system.
- '
- 'GUID paths such as "::{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" can be opened
- 'similar to file paths via Run dialog, EXPLORER.EXE argument, or the START
- 'command argument of the command prompt.
- '
- 'File path based special folders have special folder view when opened using
- 'Explorer.
- '
- 'Other special folders which have path such as
- '"FolderName.{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" can be opened after
- 'creating a folder with any name followed by a period then followed by a GUID.
- 'Some of these known special folders are only available on specific Windows
- 'version.
- '
- 'https://www.reddit.com/user/jcunews1/
- function extractname(p)
- dim i
- i = instrrev(p, "\")
- if i > 0 then
- extractname = mid(p, i + 1)
- else
- extractname = p
- end if
- end function
- function issub(fi)
- dim n
- n = extractname(fi.path)
- issub = fi.isfolder and (left(fi.path, 2) = "::") and _
- ((left(n, 2) = "::") or isnumeric(n))
- end function
- sub explore(fd, lv)
- dim fi, s
- set fi = fd.self
- if issub(fi) or ((fi.name = "Desktop") and (fi.type = "")) then
- if lv > 0 then
- s = extractname(fi.path)
- if left(s, 2) = "::" then
- redim preserve clsids(ubound(clsids) + 1)
- clsids(ubound(clsids)) = mid(s, 3)
- end if
- end if
- for each fi2 in fd.items
- if issub(fi2) then
- cnt = cnt + 1
- wscript.echo string(lv, " ") & """" & fi2.name & """ " & fi2.path
- explore fi2.getfolder, lv + 2
- end if
- next
- end if
- end sub
- dim clsids()
- redim clsids(-1)
- wscript.echo "[Desktop]"
- set sa = createobject("shell.application")
- cnt = 0
- explore sa.namespace(0), 0
- wscript.echo vbcrlf & "Total: " & cnt
- wscript.echo vbcrlf & "[Global]"
- dim unusables(9)
- unusables(0) = "{04731B67-D933-450A-90E6-4ACD2E9408FE}" 'search result
- unusables(1) = "{64693913-1C21-4F30-A98F-4E52906D3B56}" '?app instance?
- unusables(2) = "{89D83576-6BD1-4C86-9454-BEB04E94C819}" 'office outlook
- unusables(3) = "{8FD8B88D-30E1-4F25-AC2B-553D3D65F0EA}" 'external devices
- unusables(4) = "{98F275B4-4FFF-11E0-89E2-7B86DFD72085}" 'startmenu launcher provider
- unusables(5) = "{A00EE528-EBD9-48B8-944A-8942113D46AC}" 'startmenu commanding provider
- unusables(6) = "{BD7A2E7B-21CB-41B2-A086-B309680C6B7E}" 'offline files
- unusables(7) = "{DAF95313-E44D-46AF-BE1B-CBACEA2C3065}" 'startmenu provider
- unusables(8) = "{E345F35F-9397-435C-8F95-4E922C26259E}" 'startmenu path complete provider
- unusables(9) = "{EDC978D6-4D53-4B2F-A265-5805674BE568}" 'stream backed folder
- dim names(0)
- names(0) = split("{450D8FBA-AD25-11D0-98A8-0800361B1103}|My Documents", "|")
- set ws = createobject("wscript.shell")
- HKCR = &h80000000
- set reg = getobject("winmgmts:{impersonationlevel=impersonate}!\\.\root\default:stdregprov")
- reg.enumkey HKCR, "CLSID", keys
- cnt = 0
- on error resume next
- for each key in keys
- key = ucase(key)
- for i = 0 to ubound(unusables)
- if unusables(i) = key then
- key = ""
- exit for
- end if
- next
- if (key <> "") and ((reg.getdwordvalue(HKCR, "CLSID\" & key & "\ShellFolder", "Attributes", val) = 0) or (reg.getbinaryvalue(HKCR, "CLSID\" & key & "\ShellFolder", "Attributes", val) = 0)) then
- reg.getstringvalue HKCR, "CLSID\" & key, "", val
- if vartype(val) <> vbstring then val = ""
- set fd = nothing
- set fd = sa.namespace("::" & key)
- if not (fd is nothing) then
- for i = 0 to ubound(clsids)
- if clsids(i) = key then
- key = ""
- exit for
- end if
- next
- if key <> "" then
- cnt = cnt + 1
- if val <> "" then
- val = """" & val & """"
- else
- val = """"""
- for i = 0 to ubound(names)
- if names(i)(0) = key then
- val = "<" & names(i)(1) & ">"
- exit for
- end if
- next
- end if
- wscript.echo val & " ::" & key
- end if
- end if
- end if
- next
- on error goto 0
- wscript.echo vbcrlf & "Total: " & cnt
- wscript.echo vbcrlf & "[File System]"
- set fs = createobject("scripting.filesystemobject")
- cnt = 0
- for i = 0 to &H5F
- set fd = sa.namespace(i)
- if not (fd is nothing) then
- set fi = fd.self
- p = fi.path
- if left(p, 2) = "::" then p = ""
- if (p <> "") and fs.fileexists(p & "\desktop.ini") then
- set f = fs.opentextfile(p & "\desktop.ini", 1)
- h = false
- do while not f.atendofstream
- s = trim(f.readline)
- if s = "[.ShellClassInfo]" then
- h = true
- elseif s <> "" then
- s = split(s, "=")
- if (ubound(s) = 1) and (right(ucase(s(0)), 5) = "CLSID") and h then
- p = ""
- exit do
- end if
- end if
- loop
- f.close
- if p = "" then
- cnt = cnt + 1
- wscript.echo """" & fi.name &""" "& fi.path
- end if
- end if
- end if
- next
- wscript.echo "<.NET Assembly> C:\Windows\assembly"
- wscript.echo vbcrlf & "Total: " & cnt + 1
- wscript.echo vbcrlf & "[Known Other Special Folders]"
- wscript.echo "<Win2K/XP/2K3 ActiveX Cache> FolderName.{88C6C381-2E85-11D0-94DE-444553540000}"
- wscript.echo "<Win2K/XP/2K3 Internet Explorer History> FolderName.{FF393560-C2A7-11CF-BFF4-444553540000}"
- wscript.echo "<Vista+ Control Panel (all)> FolderName.{ED7BA470-8E54-465E-825C-99712043E01C}"
- wscript.echo "<Vista+ Recent Folders> FolderName.{22877a6d-37a1-461a-91b0-dbda5aaebc99}"
- wscript.echo vbcrlf & "Total: 4"
Add Comment
Please, Sign In to add comment