'================================================================== ' Shell コマンドのショートカットを作成しますYO! 'http://d.hatena.ne.jp/palm84/20150916/1442398547 'http://www10.plala.or.jp/palm84/wsh.html 'http://www10.plala.or.jp/palm84/archives/wsh/Windows_CreateShellCommandsShortCut.vbs.txt 'https://eu7w9wsmf6a74xyjdfzl3q-on.drv.tw/archives/wsh/Windows_CreateShellCommandsShortCut.vbs.txt '================================================================== 'Shell オブジェクトを作成 Set objShell = WScript.CreateObject("WScript.Shell") 'FileSystemObject オブジェクトを作成 Set objFSO = WScript.CreateObject("Scripting.FileSystemObject") Const Reg_ProductName = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName" myOS = objShell.RegRead(Reg_ProductName) If InStr(myOS, "Windows 10") = 0 And InStr(myOS, "Windows 8") = 0 And InStr(myOS, "Windows 7") = 0 Then MsgBox "Windows 10/8/7 用クマー (´;ω;`) ",48 ,"I am Sorry, ヒゲソ..(ry" WScript.Quit End If MyKakunin '*** 環境変数とか取得 *** Const ForReading = 1, ForWriting = 2, ForAppending = 8 Const INIFile = "desktop.ini" appPath = objFSO.GetParentFolderName(WScript.ScriptFullName) '*** ショートカット基本設定 *** strFile = "%windir%\explorer.exe" myFolder = appPath & "\ShellCommands ショートカット" If Not objFSO.FolderExists(myFolder) Then objFSO.CreateFolder(myFolder) End IF strWorkingDirectory = "" strIcon = "%windir%\explorer.exe,1" '*** shell: *** '* Dim strTitle(143), strCommand(143) '* Windows 10 のみ If InStr(myOS, "Windows 10") > 0 Then strTitle(0) = "3D Objects (3D オブジェクト)" strCommand(0) = "shell:3D Objects" strTitle(1) = "CameraRollLibrary (ライブラリ-カメラ ロール)" strCommand(1) = "shell:CameraRollLibrary" strTitle(2) = "Captures (ビデオ-キャプチャ)" strCommand(2) = "shell:Captures" strTitle(3) = "Common Start Menu Places" strCommand(3) = "shell:Common Start Menu Places" strTitle(4) = "Development Files" strCommand(4) = "shell:Development Files" strTitle(5) = "Local Documents" strCommand(5) = "shell:Local Documents" strTitle(6) = "Local Downloads" strCommand(6) = "shell:Local Downloads" strTitle(7) = "Local Music" strCommand(7) = "shell:Local Music" strTitle(8) = "Local Pictures" strCommand(8) = "shell:Local Pictures" strTitle(9) = "Local Videos" strCommand(9) = "shell:Local Videos" strTitle(10) = "OneDriveCameraRoll (OneDrive-画像-カメラ ロール)" strCommand(10) = "shell:OneDriveCameraRoll" strTitle(11) = "OneDriveDocuments (OneDrive-ドキュメント)" strCommand(11) = "shell:OneDriveDocuments" strTitle(12) = "OneDriveMusic (OneDrive-ミュージック)" strCommand(12) = "shell:OneDriveMusic" strTitle(13) = "OneDrivePictures (OneDrive-画像)" strCommand(13) = "shell:OneDrivePictures" strTitle(14) = "Recorded Calls" strCommand(14) = "shell:Recorded Calls" strTitle(15) = "Retail Demo" strCommand(15) = "shell:Retail Demo" strTitle(16) = "SavedPictures (保存済みの写真)" strCommand(16) = "shell:SavedPictures" strTitle(17) = "SavedPicturesLibrary (ライブラリ-保存済みの写真)" strCommand(17) = "shell:SavedPicturesLibrary" strTitle(18) = "StartMenuAllPrograms" strCommand(18) = "shell:StartMenuAllPrograms" strTitle(19) = "ThisDeviceFolder (このデバイス)" strCommand(19) = "shell:ThisDeviceFolder" End If '* Windows 10 / 8 If InStr(myOS, "Windows 10") > 0 Or InStr(myOS, "Windows 8") > 0 Then strTitle(20) = "AccountPictures (アカウントの画像)" strCommand(20) = "shell:AccountPictures" strTitle(21) = "Application Shortcuts (アプリケーションのショートカット)" strCommand(21) = "shell:Application Shortcuts" strTitle(22) = "AppsFolder (Applications)" strCommand(22) = "shell:AppsFolder" strTitle(23) = "Camera Roll" strCommand(23) = "shell:Camera Roll" strTitle(24) = "HomeGroupCurrentUserFolder" strCommand(24) = "shell:HomeGroupCurrentUserFolder" strTitle(25) = "PublicAccountPictures (パブリック アカウントの画像)" strCommand(25) = "shell:PublicAccountPictures" strTitle(26) = "Roamed Tile Images" strCommand(26) = "shell:Roamed Tile Images" strTitle(27) = "Roaming Tiles" strCommand(27) = "shell:Roaming Tiles" strTitle(28) = "Screenshots (スクリーンショット)" strCommand(28) = "shell:Screenshots" strTitle(29) = "SearchHistoryFolder" strCommand(29) = "shell:SearchHistoryFolder" strTitle(30) = "SearchTemplatesFolder" strCommand(30) = "shell:SearchTemplatesFolder" strTitle(31) = "ThisPCDesktopFolder (デスクトップ)" strCommand(31) = "shell:ThisPCDesktopFolder" End If '* Windows 10 / 8 / 7 strTitle(32) = "AddNewProgramsFolder (プログラムの取得)" strCommand(32) = "shell:AddNewProgramsFolder" strTitle(33) = "Administrative Tools (Windows 管理ツール)" strCommand(33) = "shell:Administrative Tools" strTitle(34) = "AppData" strCommand(34) = "shell:AppData" strTitle(35) = "AppUpdatesFolder (インストールされた更新プログラム)" strCommand(35) = "shell:AppUpdatesFolder" strTitle(36) = "Cache (INetCache)" strCommand(36) = "shell:Cache" strTitle(37) = "CD Burning" strCommand(37) = "shell:CD Burning" strTitle(38) = "ChangeRemoveProgramsFolder (プログラムと機能)" strCommand(38) = "shell:ChangeRemoveProgramsFolder" strTitle(39) = "Common Administrative Tools (Windows 管理ツール AllUsers)" strCommand(39) = "shell:Common Administrative Tools" strTitle(40) = "Common AppData" strCommand(40) = "shell:Common AppData" strTitle(41) = "Common Desktop (パブリックのデスクトップ)" strCommand(41) = "shell:Common Desktop" strTitle(42) = "Common Documents (パブリックのドキュメント)" strCommand(42) = "shell:Common Documents" strTitle(43) = "CommonDownloads (パブリックのダウンロード)" strCommand(43) = "shell:CommonDownloads" strTitle(44) = "CommonMusic (パブリックのミュージック)" strCommand(44) = "shell:CommonMusic" strTitle(45) = "CommonPictures (パブリックのピクチャ)" strCommand(45) = "shell:CommonPictures" strTitle(46) = "Common Programs (スタートメニュー-プログラム AllUsers)" strCommand(46) = "shell:Common Programs" strTitle(47) = "CommonRingtones" strCommand(47) = "shell:CommonRingtones" strTitle(48) = "Common Start Menu (スタートメニュー AllUsers)" strCommand(48) = "shell:Common Start Menu" strTitle(49) = "Common Startup (スタートメニュー-スタートアップ AllUsers)" strCommand(49) = "shell:Common Startup" strTitle(50) = "Common Templates" strCommand(50) = "shell:Common Templates" strTitle(51) = "CommonVideo (パブリックのビデオ)" strCommand(51) = "shell:CommonVideo" strTitle(52) = "ConflictFolder" strCommand(52) = "shell:ConflictFolder" strTitle(53) = "ConnectionsFolder (同期センター-競合)" strCommand(53) = "shell:ConnectionsFolder" strTitle(54) = "Contacts (アドレス帳)" strCommand(54) = "shell:Contacts" strTitle(55) = "ControlPanelFolder (コントロール パネル)" strCommand(55) = "shell:ControlPanelFolder" strTitle(56) = "Cookies" strCommand(56) = "shell:Cookies" strTitle(57) = "Cookies_Low" strCommand(57) = "shell:Cookies\Low" strTitle(58) = "CredentialManager" strCommand(58) = "shell:CredentialManager" strTitle(59) = "CryptoKeys" strCommand(59) = "shell:CryptoKeys" strTitle(60) = "desktop (デスクトップ)" strCommand(60) = "shell:desktop" strTitle(61) = "device Metadata Store" strCommand(61) = "shell:device Metadata Store" strTitle(62) = "documentsLibrary (ライブラリ-ドキュメント)" strCommand(62) = "shell:documentsLibrary" strTitle(63) = "downloads (ダウンロード)" strCommand(63) = "shell:downloads" strTitle(64) = "dpapiKeys" strCommand(64) = "shell:dpapiKeys" strTitle(65) = "Favorites (お気に入り)" strCommand(65) = "shell:Favorites" strTitle(66) = "Fonts" strCommand(66) = "shell:Fonts" strTitle(67) = "Games (ゲーム)" strCommand(67) = "shell:Games" strTitle(68) = "GameTasks (GameExplorer)" strCommand(68) = "shell:GameTasks" strTitle(69) = "History" strCommand(69) = "shell:History" strTitle(70) = "ImplicitAppShortcuts" strCommand(70) = "shell:ImplicitAppShortcuts" strTitle(71) = "InternetFolder" strCommand(71) = "shell:InternetFolder" strTitle(72) = "Libraries (ライブラリ)" strCommand(72) = "shell:Libraries" strTitle(73) = "Links (リンク)" strCommand(73) = "shell:Links" strTitle(74) = "Local AppData" strCommand(74) = "shell:Local AppData" strTitle(75) = "LocalAppDataLow" strCommand(75) = "shell:LocalAppDataLow" strTitle(76) = "MusicLibrary (ライブラリ-ミュージック)" strCommand(76) = "shell:MusicLibrary" strTitle(77) = "MyComputerFolder (PC)" strCommand(77) = "shell:MyComputerFolder" strTitle(78) = "My Music (ミュージック)" strCommand(78) = "shell:My Music" strTitle(79) = "My Pictures (ピクチャ)" strCommand(79) = "shell:My Pictures" strTitle(80) = "My Video (ビデオ)" strCommand(80) = "shell:My Video" strTitle(81) = "NetHood (Network Shortcuts)" strCommand(81) = "shell:NetHood" strTitle(82) = "NetworkPlacesFolder (ネットワーク)" strCommand(82) = "shell:NetworkPlacesFolder" strTitle(83) = "Personal (ドキュメント)" strCommand(83) = "shell:Personal" strTitle(84) = "PicturesLibrary (ライブラリ-ピクチャ)" strCommand(84) = "shell:PicturesLibrary" strTitle(85) = "PrintersFolder (プリンター)" strCommand(85) = "shell:PrintersFolder" strTitle(86) = "PrintHood (Printer Shortcuts)" strCommand(86) = "shell:PrintHood" strTitle(87) = "Profile" strCommand(87) = "shell:Profile" strTitle(88) = "ProgramFiles" strCommand(88) = "shell:ProgramFiles" strTitle(89) = "ProgramFilesCommon" strCommand(89) = "shell:ProgramFilesCommon" strTitle(90) = "ProgramFilesCommonX64" strCommand(90) = "shell:ProgramFilesCommonX64" strTitle(91) = "ProgramFilesCommonX86" strCommand(91) = "shell:ProgramFilesCommonX86" strTitle(92) = "ProgramFilesX64" strCommand(92) = "shell:ProgramFilesX64" strTitle(93) = "ProgramFilesX86" strCommand(93) = "shell:ProgramFilesX86" strTitle(94) = "Programs (スタートメニュー-プログラム)" strCommand(94) = "shell:Programs" strTitle(95) = "Public (パブリック)" strCommand(95) = "shell:Public" strTitle(96) = "PublicGameTasks (パブリック GameExplorer)" strCommand(96) = "shell:PublicGameTasks" strTitle(97) = "PublicLibraries (パブリック ライブラリ)" strCommand(97) = "shell:PublicLibraries" strTitle(98) = "Quick Launch (クイック起動)" strCommand(98) = "shell:Quick Launch" strTitle(99) = "Recent (最近使った項目)" strCommand(99) = "shell:Recent" strTitle(100) = "RecordedTVLibrary" strCommand(100) = "shell:RecordedTVLibrary" strTitle(101) = "RecycleBinFolder (ごみ箱)" strCommand(101) = "shell:RecycleBinFolder" strTitle(102) = "ResourceDir (Resources)" strCommand(102) = "shell:ResourceDir" strTitle(103) = "Ringtones" strCommand(103) = "shell:Ringtones" strTitle(104) = "SavedGames (保存したゲーム)" strCommand(104) = "shell:SavedGames" strTitle(105) = "Searches (検索)" strCommand(105) = "shell:Searches" strTitle(106) = "SearchHomeFolder (検索ツール)" strCommand(106) = "shell:SearchHomeFolder" strTitle(107) = "SendTo (送る)" strCommand(107) = "shell:SendTo" strTitle(108) = "Start Menu (スタートメニュー-プログラム)" strCommand(108) = "shell:Start Menu" strTitle(109) = "Startup (スタートメニュー-スタートアップ)" strCommand(109) = "shell:Startup" strTitle(110) = "SyncCenterFolder (同期センター)" strCommand(110) = "shell:SyncCenterFolder" strTitle(111) = "SyncResultsFolder (同期結果)" strCommand(111) = "shell:SyncResultsFolder" strTitle(112) = "SyncSetupFolder (同期のセットアップ)" strCommand(112) = "shell:SyncSetupFolder" strTitle(113) = "System (System32)" strCommand(113) = "shell:System" strTitle(114) = "SystemCertificates" strCommand(114) = "shell:SystemCertificates" strTitle(115) = "SystemX86 (SysWOW64)" strCommand(115) = "shell:SystemX86" strTitle(116) = "Templates" strCommand(116) = "shell:Templates" strTitle(117) = "UsersFilesFolder" strCommand(117) = "shell:UsersFilesFolder" strTitle(118) = "User Pinned" strCommand(118) = "shell:User Pinned" strTitle(119) = "UserProfiles" strCommand(119) = "shell:UserProfiles" strTitle(120) = "UsersLibrariesFolder (ライブラリ)" strCommand(120) = "shell:UsersLibrariesFolder" strTitle(121) = "VideosLibrary (ライブラリ-ビデオ)" strCommand(121) = "shell:VideosLibrary" strTitle(122) = "Windows" strCommand(122) = "shell:Windows" strTitle(123) = "CSCFolder" strCommand(123) = "shell:CSCFolder" strTitle(124) = "HomeGroupFolder (ホームグループ)" strCommand(124) = "shell:HomeGroupFolder" strTitle(125) = "MAPIFolder" strCommand(125) = "shell:MAPIFolder" strTitle(126) = "OEM Links" strCommand(126) = "shell:OEM Links" strTitle(127) = "OneDrive" strCommand(127) = "shell:OneDrive" strTitle(128) = "Original Images" strCommand(128) = "shell:Original Images" strTitle(129) = "PhotoAlbums" strCommand(129) = "shell:PhotoAlbums" strTitle(130) = "Playlists" strCommand(130) = "shell:Playlists" strTitle(131) = "UserProgramFiles (AppData_Local_Programs)" strCommand(131) = "shell:UserProgramFiles" strTitle(132) = "UserProgramFilesCommon (AppData_Local_Programs_Common)" strCommand(132) = "shell:UserProgramFilesCommon" '* Windows 8 のみ If InStr(myOS, "Windows 8") > 0 Then strTitle(133) = "SkyDriveCameraRoll (OneDrive-画像-カメラ ロール)" strCommand(133) = "shell:SkyDriveCameraRoll" strTitle(134) = "SkyDriveDocuments (OneDrive-ドキュメント)" strCommand(134) = "shell:SkyDriveDocuments" strTitle(135) = "SkyDriveMusic (OneDrive-ミュージック)" strCommand(135) = "shell:SkyDriveMusic" strTitle(136) = "SkyDrivePictures (OneDrive-画像)" strCommand(136) = "shell:SkyDrivePictures" End If '* Windows 7 のみ If InStr(myOS, "Windows 7") > 0 Then strTitle(137) = "Default Gadgets" strCommand(137) = "shell:Default Gadgets" strTitle(138) = "Gadgets" strCommand(138) = "shell:Gadgets" strTitle(139) = "SampleMusic" strCommand(139) = "shell:SampleMusic" strTitle(140) = "SamplePictures" strCommand(140) = "shell:SamplePictures" strTitle(141) = "SamplePlaylists" strCommand(141) = "shell:SamplePlaylists" strTitle(142) = "SampleVideos" strCommand(142) = "shell:SampleVideos" strTitle(143) = "Virtual Machines" strCommand(143) = "shell:Virtual Machines" End If For x = 0 to 143 If strTitle(x) <> "" Then Title = strTitle(x) strArguments = strCommand(x) 'strIcon = AppsIcon(x) MySC End If Next MyCreateINI Kakunin = MsgBox ("終了です YO!", 64 ,"クマー! (´・ω・`) ") Set objShortcut = Nothing Set objFSO = Nothing Set objShell = Nothing '********************************************************* 'Sub MyKakunin '********************************************************* Sub MyKakunin Kakunin = MsgBox ("Shell コマンドのショートカットを作りますのん? (´・ω・`)", 65 ,"Shell コマンドのショートカットを作るYO! (´・ω・`) ") If Kakunin = 2 Then WScript.Quit End If End Sub '********************************************************* 'Sub MySC '********************************************************* Sub MySC strShortCut = myFolder & "\" & Title & ".lnk" '*** ショートカットオブジェクトを作成 *** Set objShortCut = objShell.CreateShortcut(strShortCut) With objShortCut ' リンク先 .TargetPath = strFile ' 作業フォルダ .WorkingDirectory = strWorkingDirectory ' 引数 .Arguments = strArguments ' コメント .Description = "" ' アイコン .IconLocation = strIcon End With objShortCut.Save End Sub '********************************************************* ' Sub MyCreateINI '********************************************************* Sub MyCreateINI ' desktop.ini 作成 strINI = myFolder & "\" & INIFile Set objTxt = objFSO.OpenTextFile(strINI, ForWriting, true, -2) objTxt.WriteLine "[.ShellClassInfo]" objTxt.WriteLine "IconResource=" & strIcon objTxt.Close 'ファイルにシステム・隠し属性 Set objFile = objFSO.GetFile(strINI) objFile.Attributes = objFile.Attributes + 6 'フォルダに読み取り専用属性 Set objFolder = objFSO.GetFolder(myFolder) objFolder.Attributes = objFolder.Attributes + 1 End Sub