'================================================================== ' Windows 8 の「PC設定」ショートカットを作成しますYO! 'http://d.hatena.ne.jp/palm84/20150813/1439465303 'http://www10.plala.or.jp/palm84/wsh.html 'http://www10.plala.or.jp/palm84/archives/wsh/Win8_CreatePCSettingsShortCut.vbs.txt 'https://eu7w9wsmf6a74xyjdfzl3q-on.drv.tw/archives/wsh/Win8_CreatePCSettingsShortCut.vbs.txt '================================================================== 'Shell オブジェクトを作成 Set objShell = WScript.CreateObject("WScript.Shell") 'FileSystemObject オブジェクトを作成 Set objFSO = WScript.CreateObject("Scripting.FileSystemObject") Const ForReading = 1, ForWriting = 2, ForAppending = 8 Const INIFile = "desktop.ini" Const Reg_ProductName = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName" myOS = objShell.RegRead(Reg_ProductName) If Not InStr(myOS, "Windows 8") > 0 Then MsgBox "Windows 8 専用クマー (´;ω;`) ",48 ,"I am Sorry, ヒゲソ..(ry" WScript.Quit End If '*** path *** appPath = objFSO.GetParentFolderName(WScript.ScriptFullName) myRoot = appPath & "\PC設定ショートカット" Content = objShell.ExpandEnvironmentStrings("%LOCALAPPDATA%\Packages\windows.immersivecontrolpanel_cw5n1h2txyewy\LocalState\Indexed\Settings\ja-JP\") MyKakunin If Not objFSO.FolderExists(myRoot) Then objFSO.CreateFolder(myRoot) End IF ReDim arrCategory(8) arrCategory(0) = "PCとデバイス" arrCategory(1) = "アカウント" arrCategory(2) = "OneDrive" arrCategory(3) = "検索とアプリ" arrCategory(4) = "プライバシー" arrCategory(5) = "ネットワーク" arrCategory(6) = "時刻と言語" arrCategory(7) = "簡単操作" arrCategory(8) = "保守と管理" For x = 0 To 8 dirCategory = myRoot & "\" & arrCategory(x) If Not objFSO.FolderExists(dirCategory) Then objFSO.CreateFolder(dirCategory) End If Next strFile = "%windir%\explorer.exe" '*** PC設定 *** myFolder = myRoot Title = "PC設定" strFile = "%windir%\explorer.exe" strArguments = "shell:AppsFolder\Windows.ImmersiveControlPanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel" strWorkingDirectory = "" strIcon = "%windir%\ImmersiveControlPanel\SystemSettings.exe, 0" MySC '*** xxxxx *** strIcon = "%SystemRoot%\ImmersiveControlPanel\SystemSettings.exe, 0" Dim strTitle(50), strAAA(50) '*** PCとデバイス *** myFolder = myRoot & "\PCとデバイス" strTitle(0) = "ロック画面" strAAA(0) = "AAA_SettingsPageLockScreen" strTitle(1) = "ディスプレイ" strAAA(1) = "AAA_SettingsPagePCSystemDisplay" strTitle(2) = "デバイス" strAAA(2) = "AAA_SettingsPagePCSystemDevices" strTitle(3) = "マウスとタッチパッド" strAAA(3) = "AAA_SettingsPagePCSystemDeviceSettings" strTitle(4) = "Bluetooth 設定" strAAA(4) = "AAA_SettingsPagePCSystemBluetooth" strTitle(5) = "入力" strAAA(5) = "AAA_SettingsPageTimeRegionSpelling" strTitle(6) = "画面の操作" strAAA(6) = "AAA_SettingsPageAppsSwitching" strTitle(7) = "電源とスリープ" strAAA(7) = "AAA_SettingsPageScreenPowerAndSleep" strTitle(8) = "自動再生" strAAA(8) = "AAA_SettingsPagePCSystemAutoPlay" 'strTitle(9) = "" 'strAAA(9) = "" strTitle(10) = "ディスク領域" strAAA(10) = "AAA_SettingsPagePCDiskSpace" strTitle(11) = "PC情報" strAAA(11) = "AAA_SettingsGroupPCSystemSupportInfo" For y = 0 to 11 If strTitle(y) <> "" Then Title = strTitle(y) strArguments = Content & strAAA(y) & ".settingcontent-ms" MySC End If Next '*** アカウント *** myFolder = myRoot & "\アカウント" strTitle(12) = "お使いのアカウント" strAAA(12) = "AAA_SettingsGroupYourAccount" strTitle(13) = "サインイン オプション" strAAA(13) = "AAA_SettingsPageAccountsManage" strTitle(14) = "その他のアカウント" strAAA(14) = "AAA_SettingsPageAccountsUsers" For y = 12 to 14 If strTitle(y) <> "" Then Title = strTitle(y) strArguments = Content & strAAA(y) & ".settingcontent-ms" MySC End If Next '*** OneDrive *** myFolder = myRoot & "\OneDrive" strTitle(15) = "ファイルの保存" strAAA(15) = "AAA_SettingsPageOneDriveFileStorage" strTitle(16) = "カメラロール" strAAA(16) = "AAA_SettingsPageOneDriveCameraRoll" strTitle(17) = "同期の設定" strAAA(17) = "AAA_SettingsPageAccountsSync" strTitle(18) = "従量制課金接続" strAAA(18) = "AAA_SettingsPageOneDriveMeteredConnections" For y = 15 to 18 If strTitle(y) <> "" Then Title = strTitle(y) strArguments = Content & strAAA(y) & ".settingcontent-ms" MySC End If Next '*** 検索とアプリ *** myFolder = myRoot & "\検索とアプリ" strTitle(19) = "検索" strAAA(19) = "AAA_SettingsPageAppsSearch" strTitle(20) = "共有" strAAA(20) = "AAA_SettingsPageAppsShare" strTitle(21) = "通知" strAAA(21) = "AAA_SettingsPageAppsNotifications" strTitle(22) = "アプリのサイズ" strAAA(22) = "AAA_SettingsPageAppsSizes" strTitle(23) = "既定" strAAA(23) = "AAA_SettingsPageAppsDefaults" For y = 19 to 23 If strTitle(y) <> "" Then Title = strTitle(y) strArguments = Content & strAAA(y) & ".settingcontent-ms" MySC End If Next '*** プライバシー *** myFolder = myRoot & "\プライバシー" strTitle(24) = "全般" strAAA(24) = "AAA_SettingsPagePrivacyGeneral" strTitle(25) = "位置情報" strAAA(25) = "AAA_SettingsPagePrivacyLocation" strTitle(26) = "Web カメラ" strAAA(26) = "AAA_SettingsPagePrivacyWebcam" strTitle(27) = "マイク" strAAA(27) = "AAA_SettingsPagePrivacyMicrophone" strTitle(28) = "その他のデバイス" strAAA(28) = "AAA_SettingsPagePrivacyCustomPeripherals" For y = 24 to 28 If strTitle(y) <> "" Then Title = strTitle(y) strArguments = Content & strAAA(y) & ".settingcontent-ms" MySC End If Next '*** ネットワーク *** myFolder = myRoot & "\ネットワーク" strTitle(29) = "接続" strAAA(29) = "AAA_SettingsPageNetworkConnections" strTitle(30) = "プロキシ" strAAA(30) = "AAA_SettingsPageNetworkProxy" strTitle(31) = "ホームグループ" strAAA(31) = "AAA_SettingsPageNetworkHomeGroup" strTitle(32) = "社内ネットワーク" strAAA(32) = "AAA_SettingsPageNetworkWorkplace" strTitle(33) = "WiFiの設定を変更する" strAAA(33) = "AAA_SystemSettings_Connections_MediaItem_Wifi" For y = 29 to 33 If strTitle(y) <> "" Then Title = strTitle(y) strArguments = Content & strAAA(y) & ".settingcontent-ms" MySC End If Next '*** 時刻と言語 *** myFolder = myRoot & "\時刻と言語" strTitle(34) = "日付と時刻" strAAA(34) = "AAA_SettingsPageTimeRegionDateTime" strTitle(35) = "地域と言語" strAAA(35) = "AAA_SettingsPageTimeRegionLanguage" For y = 34 to 35 If strTitle(y) <> "" Then Title = strTitle(y) strArguments = Content & strAAA(y) & ".settingcontent-ms" MySC End If Next '*** 簡単操作 *** myFolder = myRoot & "\簡単操作" strTitle(36) = "ナレーター" strAAA(36) = "AAA_SettingsPageEaseOfAccessNarrator" strTitle(37) = "拡大鏡" strAAA(37) = "AAA_SettingsPageEaseOfAccessMagnifier" strTitle(38) = "ハイコントラスト" strAAA(38) = "AAA_SettingsPageEaseOfAccessHighContrast" strTitle(39) = "キーボード" strAAA(39) = "AAA_SettingsPageEaseOfAccessKeyboard" strTitle(40) = "マウス" strAAA(40) = "AAA_SettingsPageEaseOfAccessMouse" strTitle(41) = "その他のオプション" strAAA(41) = "AAA_SettingsPageEaseOfAccessMoreOptions" For y = 36 to 41 If strTitle(y) <> "" Then Title = strTitle(y) strArguments = Content & strAAA(y) & ".settingcontent-ms" MySC End If Next '*** 保守と管理 *** myFolder = myRoot & "\保守と管理" strTitle(42) = "Windows Update" strAAA(42) = "AAA_SettingsPageRestoreUpdate" strTitle(43) = "ファイル履歴" strAAA(43) = "AAA_SettingsPageRestoreFileHistory" strTitle(44) = "回復" strAAA(44) = "AAA_SettingsPageRestoreRestore" For y = 42 to 44 If strTitle(y) <> "" Then Title = strTitle(y) strArguments = Content & strAAA(y) & ".settingcontent-ms" MySC End If Next '*** Windows Update *** myFolder = myRoot Title = "Windows Update" strArguments = Content & "Classic_{36eef7db-88ad-4e81-ad49-0e313f0c35f8}" & ".settingcontent-ms" strIcon = "%SystemRoot%\System32\shell32.dll, 46" MySC '*** ネットワーク接続 *** myFolder = myRoot Title = "ネットワーク接続" strArguments = Content & "Classic_{9EF86966-2F35-49BE-A9F6-398E0B844411}" & ".settingcontent-ms" strIcon = "%SystemRoot%\System32\netshell.dll, 0" MySC '*** コントロール パネル *** myFolder = myRoot Title = "コントロール パネル" strFile = "%windir%\System32\control.exe" strArguments = "" strIcon = "%SystemRoot%\System32\shell32.dll, 21" MySC '*** GodMode *** strFolder = myRoot Title = "GodMode" strFolder = myRoot & "\" & Title strCLSID = "{ED7BA470-8E54-465E-825C-99712043E01C}" strIcon = "%SystemRoot%\system32\shell32.dll, 207" If Not objFSO.FolderExists(strFolder) Then MyCreateFolder End If '*** GodMode (リンク) *** Title = "GodMode (リンク)" strFile = "%windir%\explorer.exe" strArguments = myRoot & "\" & "GodMode" strIcon = "%SystemRoot%\system32\shell32.dll, 207" MySC Kakunin = MsgBox ("終了です YO!", 64 ,"クマー! (´・ω・`) ") Set objTxt = Nothing Set objShortcut = Nothing Set objFSO = Nothing Set objShell = Nothing '********************************************************* 'Sub MyKakunin '********************************************************* Sub MyKakunin Kakunin = MsgBox ("PC設定ショートカットを作りますのん? (´・ω・`)", 65 ,"PC設定ショートカットを作る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 ''WScript.Echo strFileName & "にショートカットを作成しました。" 'MsgBox "ショートカットを作成しました YO!" & vbcrlf & vbcrlf & Title,64 ,"(´・ω・`) クマー! " End Sub '********************************************************* '* Sub MyCreateFolder '********************************************************* Sub MyCreateFolder 'フォルダが存在するなら何もしない、なければ作成 If Not objFSO.FolderExists(strFolder) Then objFSO.CreateFolder strFolder End If ' desktop.ini 作成 strINI = strFolder & "\" & INIFile Set objTxt = objFSO.OpenTextFile(strINI, ForWriting, true, -2) objTxt.WriteLine "[.ShellClassInfo]" objTxt.WriteLine "CLSID=" & strCLSID objTxt.Close 'ファイルにシステム・隠し属性 Set objFile = objFSO.GetFile(strINI) objFile.Attributes = objFile.Attributes + 6 'フォルダ属性 Set objFolder = objFSO.GetFolder(strFolder) 'フォルダにシステム属性 objFolder.Attributes = objFolder.Attributes + 4 'フォルダにシステム&隠し属性 'objFolder.Attributes = objFolder.Attributes + 6 End Sub