'================================================================== 'Windows 8, 10 にスタートメニューもどきを作成しますYO! 'http://d.hatena.ne.jp/palm84/20150823/1440328044 'http://d.hatena.ne.jp/palm84/20121028/1351419637 'http://www10.plala.or.jp/palm84/wsh.html 'http://www10.plala.or.jp/palm84/archives/wsh/Windows_CreateQuickStartMenu.vbs.txt 'https://eu7w9wsmf6a74xyjdfzl3q-on.drv.tw/archives/wsh/Windows_CreateQuickStartMenu.vbs.txt '================================================================== '最終更新 2019.08.14 Windows 8 対応? 'Update 2017.10.22 01:34 Fall Creators Update ReleaseID 1709 対応, 「管理ツール」を修正 'Update 2018.05.03 13:24 ReleaseID 1803 対応 'Update 2018.12.26 October 2018 Update (ReleaseID 1809) 対応 'Update 2019.07.16 May 2019 Update, バージョン 1903 対応 'Shell オブジェクトを作成 Set objShell = WScript.CreateObject("WScript.Shell") 'FileSystemObject オブジェクトを作成 Set objFSO = WScript.CreateObject("Scripting.FileSystemObject") '*** 定数 *** Const ForReading = 1, ForWriting = 2, ForAppending = 8 Const Reg_ProductName = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName" Const Reg_ReleaseId = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ReleaseId" Const Reg_Favorites = "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Favorites" Const INIFile = "desktop.ini" '*** 環境変数とか取得 *** myOS = objShell.RegRead(Reg_ProductName) If InStr(myOS, "Windows 10") > 0 Then myReleaseId = objShell.RegRead(Reg_ReleaseId) End If QuickLaunch = objShell.ExpandEnvironmentStrings("%APPDATA%\Microsoft\Internet Explorer\Quick Launch") Content1 = objShell.ExpandEnvironmentStrings("%LOCALAPPDATA%\Packages\windows.immersivecontrolpanel_cw5n1h2txyewy\LocalState\Indexed\Settings\ja-JP\") Content2 = objShell.ExpandEnvironmentStrings("%Windir%\ImmersiveControlPanel\Settings\") If objFSO.FolderExists(Content1) Then Content = Content1 ElseIf objFSO.FolderExists(Content2) Then Content = Content2 End IF '*** *** 'strName = "" 'strCLSID = "{}" 'MyCreateFolder MyKakunin '*** お気に入り *** myFavorites = objShell.RegRead(Reg_Favorites) objShell.Run "%comspec% /c if not exist ""%AppData%\Microsoft\Internet Explorer\Quick Launch\お気に入り"" mklink /J ""%AppData%\Microsoft\Internet Explorer\Quick Launch\お気に入り""" & " " & """" & myFavorites & """" 'objShell.Run "cmd.exe /c if not exist ""%AppData%\Microsoft\Internet Explorer\Quick Launch\お気に入り"" mklink /J ""%AppData%\Microsoft\Internet Explorer\Quick Launch\お気に入り"" ""%USERPROFILE%\Favorites""" 'objShell.Run "cmd.exe /c if not exist ""%AppData%\Microsoft\Internet Explorer\Quick Launch\お気に入り"" for /f ""usebackq tokens=3*"" %x in (`reg query ""HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"" /v Favorites ^| findstr /i favorites`) do mklink /J ""%AppData%\Microsoft\Internet Explorer\Quick Launch\お気に入り"" ""%x""" 'objShell.Run "cmd.exe /c if not exist ""%AppData%\Microsoft\Internet Explorer\Quick Launch\お気に入り"" for /f ""usebackq tokens=3*"" %x in (`reg query ""HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"" /v Favorites ^| findstr /i favorites`) do mklink /J ""%AppData%\Microsoft\Internet Explorer\Quick Launch\お気に入り"" ""%x %y""" '*** 最近使った項目 *** objShell.Run "%comspec% /c if not exist ""%AppData%\Microsoft\Internet Explorer\Quick Launch\最近使った項目"" mklink /J ""%AppData%\Microsoft\Internet Explorer\Quick Launch\最近使った項目"" ""%AppData%\Microsoft\Windows\Recent""" '*** プログラム *** objShell.Run "%comspec% /c if not exist ""%AppData%\Microsoft\Internet Explorer\Quick Launch\プログラム"" mklink /J ""%AppData%\Microsoft\Internet Explorer\Quick Launch\プログラム"" ""%AppData%\Microsoft\Windows\Start Menu\Programs""" '*** プログラム AllUsers *** objShell.Run "%comspec% /c if not exist ""%AppData%\Microsoft\Internet Explorer\Quick Launch\プログラム AllUsers"" mklink /J ""%AppData%\Microsoft\Internet Explorer\Quick Launch\プログラム AllUsers"" ""%ProgramData%\Microsoft\Windows\Start Menu\Programs""" '*** コンピューター *** strName = "コンピューター" strCLSID = "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" MyCreateFolder '*** ライブラリ *** strName = "ライブラリ" strCLSID = "{031E4825-7B94-4dc3-B131-E946B44C8DD5}" MyCreateFolder '*** デバイスとプリンター *** strName = "デバイスとプリンター" strCLSID = "{2227A280-3AEA-1069-A2DE-08002B30309D}" MyCreateFolder '*** ネットワーク接続 *** strName = "ネットワーク接続 (menu)" strCLSID = "{992CFFA0-F557-101A-88EC-00DD010CCC48}" MyCreateFolder '*** 管理ツール *** If InStr(myOS, "Windows 10") > 0 And myReleaseID < "1703" Then strName = "管理ツール" strCLSID = "{D20EA4E1-3957-11d2-A40B-0C5020524153}" MyCreateFolder End If '*** プログラム Windows 管理ツール *** If myReleaseID >= "1703" Then strName = "Administrative Tools" strSourceFolder = objShell.ExpandEnvironmentStrings("%ProgramData%\Microsoft\Windows\Start Menu\Programs\Administrative Tools") MyCopyFolder End If '*** ネットワーク *** strName = "ネットワーク" strCLSID = "{208D2C60-3AEA-1069-A2D7-08002B30309D}" MyCreateFolder '*** コントロール パネル *** strName = "コントロール パネル (menu)" strCLSID = "{21EC2020-3AEA-1069-A2DD-08002B30309D}" MyCreateFolder '*** GodMode *** strName = "GodMode (menu)" strCLSID = "{ED7BA470-8E54-465E-825C-99712043E01C}" MyCreateFolder '*** コントロール パネル *** 'Title = "コントロール パネル" 'strFile = "%windir%\explorer.exe" 'strArguments = Content & "ControlPanel" & ".settingcontent-ms" 'strIcon = "%SystemRoot%\System32\shell32.dll, 21" 'strWorkingDirectory = "" 'MySC '*** コントロール パネル *** Title = "コントロール パネル" strFile = "%windir%\System32\control.exe" strArguments = "" strIcon = "%SystemRoot%\System32\shell32.dll, 21" MySC '*** GodMode *** Title = "GodMode" strFile = "%windir%\explorer.exe" strArguments = QuickLaunch & "\" & strName 'strArguments = "shell:::{ED7BA470-8E54-465E-825C-99712043E01C}" strIcon = "%SystemRoot%\System32\shell32.dll, 21" strWorkingDirectory = "" MySC '*** Windows Update *** Title = "Windows Update" If InStr(myOS, "Windows 10") > 0 Then strFile = "ms-settings:windowsupdate" strArguments = "" ElseIf InStr(myOS, "Windows 8") > 0 Then strFile = "%windir%\explorer.exe" strArguments = Content & "Classic_{36eef7db-88ad-4e81-ad49-0e313f0c35f8}.settingcontent-ms" ElseIf InStr(myOS, "Windows 7") > 0 Then strFile = "%windir%\system32\wuapp.exe" strArguments = "startmenu" End If strWorkingDirectory = "" strIcon = "%SystemRoot%\System32\shell32.dll, 46" MySC ' Win7 %windir%\system32\wuapp.exe startmenu %windir%\system32\wucltux.dll, 0 ' Win8.1 C:\Windows\system32\wucltux.dll, 0 ' Win10 C:\Windows\System32\wuapi.dll, 0 '*** ネットワーク接続 *** If InStr(myOS, "Windows 10") > 0 Or InStr(myOS, "Windows 8") > 0 Then Title = "ネットワーク接続" strFile = "%windir%\System32\control.exe" strArguments = "ncpa.cpl" strIcon = "%SystemRoot%\System32\netshell.dll, 0" MySC End If '*** ネットワークと共有センター *** Title = "ネットワークと共有センター" strFile = "%windir%\explorer.exe" strArguments = Content & "Classic_{BD256B65-94BE-4194-84BF-41D50D0EF26E}" & ".settingcontent-ms" strIcon = "%SystemRoot%\System32\netcenter.dll, 0" If objFSO.FileExists(strArguments) Then MySC Else strFile = "%windir%\system32\control.exe" strArguments = "/name Microsoft.NetworkAndSharingCenter" MySC End If '*** Windows セキュリティ *** '*** Windows Defender セキュリティ センター *** If myReleaseID >= "1809" Then Title = "Windows セキュリティ" strFile = "%windir%\explorer.exe" strArguments = "shell:AppsFolder\Microsoft.Windows.SecHealthUI_cw5n1h2txyewy!SecHealthUI" strIcon = "%ProgramFiles%\Windows Defender\Offline\OfflineScannerShell.exe, 0" MySC ElseIf myReleaseID >= "1703" Then Title = "Windows Defender セキュリティ センター" strFile = "%windir%\explorer.exe" strArguments = "shell:AppsFolder\Microsoft.Windows.SecHealthUI_cw5n1h2txyewy!SecHealthUI" strIcon = "%ProgramFiles%\Windows Defender\MSASCui.exe, 0" MySC End If '*** 設定 / PC設定 *** strWorkingDirectory = "" If InStr(myOS, "Windows 10") > 0 Then Title = "設定" strFile = "ms-settings:" strArguments = "" strIcon = "%SystemRoot%\System32\shell32.dll, 315" If myReleaseID >= "1703" Then strIcon = "%SystemRoot%\System32\shell32.dll, 316" MySC ElseIf InStr(myOS, "Windows 11") > 0 Then ElseIf InStr(myOS, "Windows 8") > 0 Then Title = "PC設定" strFile = "%windir%\explorer.exe" strArguments = "shell:AppsFolder\Windows.ImmersiveControlPanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel" strIcon = "%windir%\ImmersiveControlPanel\SystemSettings.exe, 0" MySC End If If myOS = "Windows 11" Then strIcon = "%SystemRoot%\System32\shell32.dll, 314" Else strIcon = "%SystemRoot%\System32\shell32.dll, 316" End If MsgBox "クイック起動スタートメニューもどきを作成しました YO!",64 ,"(´・ω・`) クマー! " Set objTxt = Nothing Set objFile = Nothing Set objFolder = Nothing Set objFSO = Nothing Set objShell = Nothing '********************************************************* 'Sub MyKakunin '********************************************************* Sub MyKakunin Kakunin = MsgBox ("クイック起動にスタートメニューもどきを作りますのん? (´・ω・`)" & vbcrlf & vbcrlf & " ※ ジャンクションはコマンド プロンプトで設定するので" & vbcrlf & "   窓が4(5)回チラっと出ます", 65 ,"クイック起動にスタートメニューもどき(w) を作るYO! (´・ω・`) ") If Kakunin = 2 Then WScript.Quit End If End Sub '********************************************************* ' Sub MyCopyFolder '********************************************************* Sub MyCopyFolder 'フォルダが存在するなら何もしない、なければ作成 strNewFolder = QuickLaunch & "\" & strName If Not objFSO.FolderExists(strNewFolder) Then objFSO.CreateFolder strNewFolder End If objFSO.CopyFolder strSourceFolder, strNewFolder 'フォルダにシステム属性 Set objFolder = objFSO.GetFolder(strNewFolder) objFolder.Attributes = objFolder.Attributes + 4 End Sub '********************************************************* ' Sub MyCreateFolder '********************************************************* Sub MyCreateFolder 'フォルダが存在するなら何もしない、なければ作成 strNewFolder = QuickLaunch & "\" & strName If Not objFSO.FolderExists(strNewFolder) Then objFSO.CreateFolder strNewFolder Else Exit Sub End If ' desktop.ini 作成 strINI = strNewFolder & "\" & INIFile Set objTxt = objFSO.OpenTextFile(strINI, ForWriting, true, -2) objTxt.WriteLine "[.ShellClassInfo]" 'If myReleaseID = "1703" Then ' If strName = "コントロール パネル (menu)" Or strName = "GodMode (menu)" Then ' objTxt.WriteLine "LocalizedResourceName=" & strName ' End If 'End If objTxt.WriteLine "CLSID=" & strCLSID objTxt.Close 'ファイルにシステム・隠し属性 Set objFile = objFSO.GetFile(strINI) objFile.Attributes = objFile.Attributes + 6 'フォルダにシステム属性 Set objFolder = objFSO.GetFolder(strNewFolder) objFolder.Attributes = objFolder.Attributes + 4 End Sub '********************************************************* 'Sub MySC '********************************************************* Sub MySC strShortCut = QuickLaunch & "\" & 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