Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Const e = "<font color=red>Error<font>"
- On Error Resume Next
- aCLSIDs = Array("shell:AccountPictures", "shell:AddNewProgramsFolder", "shell:Administrative Tools", "shell:AppData", "shell:Application Shortcuts", "shell:AppsFolder", "shell:AppUpdatesFolder", "shell:Cache", "shell:CD Burning", "shell:ChangeRemoveProgramsFolder", "shell:Common Administrative Tools", "shell:Common AppData", "shell:Common Desktop", "shell:Common Documents", "shell:Common Programs", "shell:Common Start Menu", "shell:Common Startup", "shell:Common Templates", "shell:CommonDownloads", "shell:CommonMusic", "shell:CommonPictures", "shell:CommonRingtones", "shell:CommonVideo", "shell:ConflictFolder", "shell:ConnectionsFolder", "shell:Contacts", "shell:ControlPanelFolder", "shell:Cookies", "shell:Cookies\Low", "shell:CredentialManager", "shell:CryptoKeys", "shell:CSCFolder", "shell:Default Gadgets", "shell:Desktop", "shell:Device Metadata Store", "shell:DocumentsLibrary", "shell:Downloads", "shell:DpapiKeys", "shell:Favorites", "shell:Fonts", "shell:Gadgets", "shell:Games", "shell:GameTasks", "shell:History", "shell:HomeGroupCurrentUserFolder", "shell:HomeGroupFolder", "shell:ImplicitAppShortcuts", "shell:InternetFolder", "shell:Libraries", "shell:Libraries", "shell:Links", "shell:Local AppData", "shell:LocalAppDataLow", "shell:LocalizedResourcesDir", "shell:MAPIFolder", "shell:MusicLibrary", "shell:My Music", "shell:My Pictures", "shell:My Pictures ", "shell:My Video", "shell:MyComputerFolder", "shell:NetHood", "shell:NetworkPlacesFolder", "shell:OEM Links ", "shell:Original Images", "shell:Personal", "shell:PhotoAlbums", "shell:PicturesLibrary", "shell:Playlists", "shell:PrintersFolder", "shell:PrintHood", "shell:Profile", "shell:ProgramFiles", "shell:ProgramFilesCommon", "shell:ProgramFilesCommonX64", "shell:ProgramFilesCommonX86", "shell:ProgramFilesX64", "shell:ProgramFilesX86", "shell:Programs", "shell:Public", "shell:PublicAccountPictures", "shell:PublicGameTasks", "shell:PublicLibraries", "shell:Quick Launch", "shell:Recent", "shell:RecordedTVLibrary", "shell:RecycleBinFolder", "shell:ResourceDir", "shell:Ringtones", "shell:Roamed Tile Images", "shell:Roaming Tiles", "shell:SampleMusic", "shell:SamplePictures", "shell:SampleVideos", "shell:SavedGames", "shell:Screenshots", "shell:Searches", "shell:SearchHomeFolder", "shell:SendTo", "shell:Start Menu", "shell:Startup", "shell:SyncCenterFolder", "shell:SyncResultsFolder", "shell:SyncSetupFolder", "shell:System", "shell:SystemCertificates", "shell:SystemX86", "shell:Templates", "shell:User Pinned", "shell:UserProfiles", "shell:UserProgramFiles", "shell:UserProgramFilesCommon", "shell:UsersFilesFolder", "shell:UsersLibrariesFolder", "shell:VideosLibrary", "shell:Windows", "shell:::{3080F90E-D7AD-11D9-BD98-0000947B0257}", "shell:::{1D2680C9-0E2A-469d-B787-065558BC7D43}", "shell:::{871C5380-42A0-1069-A2EA-08002B30309D}", "shell:::{9C60DE1E-E5FC-40f4-A487-460851A8D915}", "shell:::{D24F75AA-4F2B-4D07-A3C4-469B3D9030C4}", "shell:::{D20EA4E1-3957-11d2-A40B-0C5020524153}", "shell:::{031E4825-7B94-4dc3-B131-E946B44C8DD5}", "shell:::{0142e4d0-fb7a-11dc-ba4a-000ffe7ab428}", "shell:::{4026492F-2F69-46B8-B9BF-5654FC07E423}", "shell:::{9FE63AFD-59CF-4419-9775-ABCC3849F861}", "shell:::{3f6bc534-dfa1-4ab4-ae54-ef25a74e0107}", "shell:::{ED7BA470-8E54-465E-825C-99712043E01C}", "shell:::{21EC2020-3AEA-1069-A2DD-08002B30309D}", "shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}", "shell:::{37efd44d-ef8d-41b1-940d-96973a50e9e0}", "shell:::{E2E7934B-DCE5-43C4-9576-7FE4F75E7480}", "shell:::{E9950154-C418-419e-A90A-20C5287AE24B}", "shell:::{74246bfc-4c96-11d0-abef-0020af6b0b7a}", "shell:::{1206F5F1-0569-412C-8FEC-3204630DFB70}", "shell:::{67CA7650-96E6-4FDD-BB43-A8E774F73A57}", "shell:::{6785BFAC-9D2D-4be5-B7E2-59937E8FB80A}", "shell:::{D8559EB9-20C0-410E-BEDA-7ED416AECC2A}", "shell:::{F2DDFC82-8F12-4CDD-B7DC-D4FE1425AA4D}", "shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}", "shell:::{ED228FDF-9EA8-4870-83b1-96b02CFE0D52}", "shell:::{323CA680-C24D-4099-B94D-446DD2D7249E}", "shell:::{67718415-c450-4f3c-bf8a-b487642dc39b}", "shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "shell:::{645FF040-5081-101B-9F08-00AA002F954E}", "shell:::{450D8FBA-AD25-11D0-98A8-0800361B1103}", "shell:::{2559a1f7-21d7-11d4-bdaf-00c04f60b9f0}", "shell:::{22877a6d-37a1-461a-91b0-dbda5aaebc99}", "shell:::{4336a54d-038b-4685-ab02-99bb52d3fb8b}", "shell:::{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}", "shell:::{26EE0668-A00A-44D7-9371-BEB064C98683}", "shell:::{87D66A43-7B11-4A28-9811-C86EE395ACF7}", "shell:::{6DFD7C5C-2451-11d3-A299-00C04F8EF6AF}", "shell:::{80F3F1D5-FECA-45F3-BC32-752C152E456E}", "shell:::{93412589-74D4-4E4E-AD0E-E0CB621440FD}", "shell:::{35786D3C-B075-49b9-88DD-029876E11C01}", "shell:::{F82DF8F7-8B9F-442E-A48C-818EA735FF9B}", "shell:::{ED834ED6-4B5A-4bfe-8F11-A626DCB6A921}", "shell:::{241D7C96-F8BF-4F85-B01F-E2B043341A4B}", "shell:::{2559a1f0-21d7-11d4-bdaf-00c04f60b9f0}", "shell:::{15eae92e-f17a-4431-9f28-805e482dafd4}", "shell:::{2227A280-3AEA-1069-A2DE-08002B30309D}", "shell:::{7b81be6a-ce2b-4676-a29e-eb907a5126c5}", "shell:::{17cd9488-1228-4b2f-88ce-4298e93e0966}", "shell:::{3080F90D-D7AD-11D9-BD98-0000947B0257}", "shell:::{58E3C745-D971-4081-9034-86E34B30836A}", "shell:::{00C6D95F-329C-409a-81D7-C46C66EA7F33}", "shell:::{96AE8D84-A250-4520-95A5-A47A7E3C548B}", "shell:::{0DF44EAA-FF21-4412-828E-260A8728E7F1}", "shell:::{D17D1D6D-CC3F-4815-8FE3-607E7D5D10B3}", "shell:::{A304259D-52B8-4526-8B1A-A1D6CECC8243}", "shell:::{A3DD4F92-658A-410F-84FD-6FBBBEF2FFFE}", "shell:::{725BE8F7-668E-4C7B-8F90-46BDB0936430}", "shell:::{6C8EEC18-8D75-41B2-A177-8831D59D2D50}", "shell:::{7007ACC7-3202-11D1-AAD2-00805FC1270E}", "shell:::{38A98528-6CBF-4CA9-8DC0-B1E1D10F7B1B}", "shell:::{208D2C60-3AEA-1069-A2D7-08002B30309D}", "shell:::{BB06C0E4-D293-4f75-8A90-CB05B6477EEE}", "shell:::{00f2886f-cd64-4fc9-8ec5-30ef6cdbe8c3}", "shell:::{2559a1f1-21d7-11d4-bdaf-00c04f60b9f0}", "shell:::{40419485-C444-4567-851A-2DD7BFA1684D}", "shell:::{1FA9085F-25A2-489B-85D4-86326EEDCD87}", "shell:::{B2C761C6-29BC-4f19-9251-E6195265BAF1}", "shell:::{d450a8a1-9568-45c7-9c0e-b4f9fb4537bd}", "shell:::{C58C4893-3BE0-4B45-ABB5-A63E4B8C8651}", "shell:::{28803F59-3A75-4058-995F-4EE5503B023C}", "shell:::{A8A91A66-3A7D-4424-8D24-04E180695C7A}", "shell:::{60632754-c523-4b62-b45c-4172da012619}", "shell:::{5ea4f148-308c-46d7-98a9-49041b1dd468}", "shell:::{36eef7db-88ad-4e81-ad49-0e313f0c35f8}", "shell:::{BB64F8A7-BEE7-4E1A-AB8D-7D8273F7FDB6}", "shell:::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF}", "shell:::{D555645E-D4F8-4c29-A827-D93C859C4F2A}", "shell:::{8E908FC9-BECC-40f6-915B-F4CA0E70D03D}", "shell:::{D9EF8727-CAC2-4e60-809E-86F80A666C91}", "shell:::{C555438B-3C23-4769-A71F-B6D3D9B6053A}", "shell:::{025A5937-A6BE-4686-A844-36FE4BEC8B6D}", "shell:::{62D8ED13-C9D0-4CE8-A914-47DD628FB1B0}")
- Set oWSHShell = CreateObject("WScript.Shell")
- Set oShellApp = CreateObject("Shell.Application")
- sUserPc = oWSHShell.ExpandEnvironmentStrings("%username%@%computername%")
- sReportPath = Left(WScript.ScriptFullName, InstrRev(WScript.ScriptFullName, ".") - 1) & "_" & sUserPc & ".htm"
- sShTestPath = oWSHShell.SpecialFolders("Desktop") & "\ShortcutTest\"
- SmartCreateFolder sShTestPath
- s = "<html><head><title>Test some CLSID for Shell</title><style>* {font-family: consolas, courier new; font-size: 8pt;} h1 {font-size: 14pt;} table {border-collapse: collapse; background: transparent;} td, th {border: black 1px solid; vertical-align: top; padding: 2px 5px;} th {background: lightgrey;}</style></head><body>" & sUserPc & " " & Now & "<h1>Test some CLSID for Shell</h1>"
- s = s & "<p><font color=limegreen>' VBScript example of saving .lnk shortcut and creating folder object</font><br> <br>sCLSID = <font color=crimson>""shell:::{031E4825-7B94-4dc3-B131-E946B44C8DD5}""</font> <font color=limegreen>' CLSID</font><br> <br><font color=limegreen>' WScript.Shell Shortcut</font><br><font color=darkviolet>Set</font> oWSHShell = <font color=darkorange>CreateObject</font>(<font color=crimson>""WScript.Shell""</font>)<br><font color=darkviolet>With</font> oWSHShell.CreateShortcut(<font color=crimson>""C:\Libraries.lnk""</font>)<br> .TargetPath = sCLSID<br> .Save<br> sShTargetPath = .TargetPath <font color=limegreen>' Actual Shortcut TargetPath</font><br><font color=darkviolet>End</font> <font color=darkviolet>With</font><br> <br><font color=limegreen>' Shell.Application Folder</font><br><font color=darkviolet>Set</font> oShellApp = <font color=darkorange>CreateObject</font>(<font color=crimson>""Shell.Application""</font>)<br><font color=darkviolet>Set</font> oFolder = oShellApp.NameSpace(sCLSID)<br>sNameSpace = <font color=darkorange>TypeName</font>(oFolder) <font color=limegreen>' Shell NameSpace Typename</font><br>sFolderPath = oFolder.Self.Path <font color=limegreen>' Shell Folder Path</font><br>sFolderTitle = oFolder.Title <font color=limegreen>' Shell Folder Title</font><br></p>"
- s = s & "<table><tr><th>n</th><th>CLSID</th><th>Shell NameSpace Typename</th><th>Shell Folder Title</th><th>Shell Folder Path</th><th>Shortcut TargetPath</th></tr>"
- For n = 0 To UBound(aCLSIDs)
- sCLSID = aCLSIDs(n)
- ' WScript.Shell
- With oWSHShell.CreateShortcut(sShTestPath & n & ".lnk")
- .TargetPath = sCLSID
- .Save
- sShTargetPath = .TargetPath
- End With
- If Err Then
- Err.Clear
- sShTargetPath = e
- End If
- ' Shell.Application
- Set oFolder = oShellApp.NameSpace(sCLSID)
- If Err Then
- Err.Clear
- sNameSpace = e
- sFolderPath = e
- sFolderTitle = e
- Else
- sNameSpace = TypeName(oFolder)
- If sNameSpace = "Nothing" Then
- sNameSpace = "<font color=red>Nothing<font>"
- sFolderPath = e
- sFolderTitle = e
- Else
- sFolderPath = oFolder.Self.Path
- If Err Then
- Err.Clear
- sFolderPath = e
- End If
- sFolderTitle = oFolder.Title
- If Err Then
- Err.Clear
- sFolderTitle = e
- End If
- End If
- End If
- ' results
- s = s & "<tr><td>" & n & "</td><td>" & sCLSID & "</td><td>" & sNameSpace & "</td><td>" & sFolderTitle & "</td><td>" & sFolderPath & "</td><td>" & sShTargetPath & "</td></tr>"
- Next
- s = s & "</table></body></html>"
- WriteTextFile s, sReportPath, -1
- oWSHShell.Run sReportPath
- Sub SmartCreateFolder(sFolder)
- ' http://www.visualbasicscript.com/tm.aspx?m=29290
- With CreateObject("Scripting.FileSystemObject")
- If Not .FolderExists(sFolder) then
- SmartCreateFolder .getparentfoldername(sFolder)
- .CreateFolder sFolder
- End If
- End With
- End Sub
- Sub WriteTextFile(sContent, sPath, lFormat)
- ' lFormat -2 - System default, -1 - Unicode, 0 - ASCII
- With CreateObject("Scripting.FileSystemObject").OpenTextFile(sPath, 2, True, lFormat)
- .Write sContent
- .Close
- End With
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement