'================================================================== 'クイック起動に、アクセサリ関係のショートカットを作成します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_CreateAccessoriesShortCut.vbs.txt 'https://eu7w9wsmf6a74xyjdfzl3q-on.drv.tw/archives/wsh/Windows_CreateAccessoriesShortCut.vbs.txt '================================================================== '最終更新 2019.08.14 Windows 8 対応? 'Update 2019.07.16 '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" Dim Kakunin '*** 環境変数とか取得 *** myOS = objShell.RegRead(Reg_ProductName) If InStr(myOS, "Windows 10") > 0 Then myReleaseId = objShell.RegRead(Reg_ReleaseId) End If Desktop = objShell.SpecialFolders("Desktop") QuickLaunch = objShell.ExpandEnvironmentStrings("%APPDATA%\Microsoft\Internet Explorer\Quick Launch") exeMSASCui = objShell.ExpandEnvironmentStrings("%ProgramFiles%\Windows Defender\MSASCui.exe") Content = objShell.ExpandEnvironmentStrings("%LOCALAPPDATA%\Packages\windows.immersivecontrolpanel_cw5n1h2txyewy\LocalState\Indexed\Settings\ja-JP\") '*** デスクトップの表示 *** 'Title = "デスクトップの表示" 'strFile = "%windir%\explorer.exe" 'strArguments = "shell:::{3080F90D-D7AD-11D9-BD98-0000947B0257}" 'strWorkingDirectory = "" 'strIcon = "%windir%\system32\imageres.dll, 105" 'MyKakunin 'If Kakunin = 6 Then ' MySC 'End If '*** ファイルの検索 *** Title = "ファイルの検索" strFile = QuickLaunch & "\Windows_FindFiles.vbs" strWorkingDirectory = "" strIcon = "%SystemRoot%\system32\SHELL32.dll, 55" If InStr(myOS, "Windows 8") > 0 Or InStr(myOS, "Windows 7") > 0 Then MyKakunin If Kakunin = 6 Then If objFSO.FileExists(strFile) Then MySC Else Set objTxt = objFSO.OpenTextFile(strFile, ForWriting, true, -2) objTxt.WriteLine "Set objShellAp = Wscript.CreateObject(""Shell.Application"")" objTxt.WriteLine "objShellAp.FindFiles()" objTxt.WriteLine "Set objShellAp = Nothing" objTxt.Close Set objFile = objFSO.GetFile(strFile) objFile.Attributes = objFile.Attributes + 2 MySC End If End If End If '*** ヘルプとサポート *** Title = "ヘルプとサポート" strFile = QuickLaunch & "\Windows_Help.vbs" strArguments = "" strWorkingDirectory = "" strIcon = "%windir%\system32\SHELL32.dll, 23" If InStr(myOS, "Windows 8") > 0 Or InStr(myOS, "Windows 7") > 0 Then MyKakunin If Kakunin = 6 Then If objFSO.FileExists(strFile) Then MySC Else Set objTxt = objFSO.OpenTextFile(strFile, ForWriting, true, -2) objTxt.WriteLine "Set objShellAp = Wscript.CreateObject(""Shell.Application"")" objTxt.WriteLine "objShellAp.Help()" objTxt.WriteLine "Set objShellAp = Nothing" objTxt.Close Set objFile = objFSO.GetFile(strFile) objFile.Attributes = objFile.Attributes + 2 MySC End If End If End If '*** ファイル名を指定して実行 *** Title = "ファイル名を指定して実行" strFile = QuickLaunch & "\Windows_Run.vbs" strArguments = "" strWorkingDirectory = "" strIcon = "%SystemRoot%\system32\SHELL32.dll, 24" MyKakunin If Kakunin = 6 Then If objFSO.FileExists(strFile) Then MySC Else Set objTxt = objFSO.OpenTextFile(strFile, ForWriting, true, -2) objTxt.WriteLine "Set objShellAp = Wscript.CreateObject(""Shell.Application"")" objTxt.WriteLine "objShellAp.FileRun" objTxt.WriteLine "Set objShellAp = Nothing" objTxt.Close Set objFile = objFSO.GetFile(strFile) objFile.Attributes = objFile.Attributes + 2 MySC End If End If '*** Windows Defender *** If myReleaseID < "1703" Then Title = "Windows Defender" strFile = exeMSASCui strArguments = "" strWorkingDirectory = "" strIcon = exeMSASCui & ", 0" MyKakunin If Kakunin = 6 Then MySC End If End If '*** レジストリ エディター *** Title = "レジストリ エディター" strFile = "%windir%\regedit.exe" strArguments = "" strWorkingDirectory = "%windir%" strIcon = "%windir%\regedit.exe, 0" MyKakunin If Kakunin = 6 Then MySC End If '*** コマンド プロンプト *** Title = "コマンド プロンプト" strFile = "%windir%\system32\cmd.exe" strArguments = "" strWorkingDirectory = "%HOMEDRIVE%%HOMEPATH%" strIcon = "%windir%\system32\cmd.exe, 0" MyKakunin If Kakunin = 6 Then MySC End If '*** 電卓 *** Title = "電卓" strFile = "%windir%\system32\calc.exe" strArguments = "" If InStr(myOS, "Windows 10") > 0 Then ' strFile = "calculator:" strFile = "%windir%\explorer.exe" strArguments = "shell:AppsFolder\Microsoft.WindowsCalculator_8wekyb3d8bbwe!App" End If strWorkingDirectory = "" strIcon = "%windir%\system32\calc.exe, 0" MyKakunin If Kakunin = 6 Then MySC End If '*** ペイント *** Title = "ペイント" strFile = "%windir%\system32\mspaint.exe" strArguments = "" strWorkingDirectory = "" strIcon = "%windir%\system32\mspaint.exe, 0" MyKakunin If Kakunin = 6 Then MySC End If '*** Snipping Tool *** Title = "Snipping Tool" strFile = "%windir%\system32\SnippingTool.exe" strArguments = "" strWorkingDirectory = "" strIcon = "%windir%\system32\SnippingTool.exe, 0" MyKakunin If Kakunin = 6 Then MySC End If '*** メモ帳 *** Title = "メモ帳" strFile = "%windir%\system32\notepad.exe" strArguments = "" strWorkingDirectory = "%HOMEDRIVE%%HOMEPATH%" strIcon = "%windir%\system32\notepad.exe, 0" MyKakunin If Kakunin = 6 Then MySC End If '*** エクスプローラー *** Title = "エクスプローラー" strFile = "%windir%\explorer.exe" strArguments = "" strWorkingDirectory = "" strIcon = "%windir%\explorer.exe, 0" MyKakunin If Kakunin = 6 Then MySC End If '*** Internet Explorer *** If Not objFSO.FileExists(QuickLaunch & "\Launch Internet Explorer Browser.lnk") And Not objFSO.FileExists(QuickLaunch & "\Internet Explorer.lnk") Then Title = "Internet Explorer" strFile = "%ProgramFiles%\Internet Explorer\iexplore.exe" strArguments = "" strWorkingDirectory = "%HOMEDRIVE%%HOMEPATH%" strIcon = "%ProgramFiles%\Internet Explorer\iexplore.exe, 0" MyKakunin If Kakunin = 6 Then MySC End If End If '*** Microsoft Edge *** If InStr(myOS, "Windows 10") > 0 Then Title = "Microsoft Edge" strFile = "%windir%\explorer.exe" strArguments = "shell:AppsFolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" strWorkingDirectory = "" strIcon = "%windir%\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\MicrosoftEdge.exe, 0" MyKakunin If Kakunin = 6 Then MySC End If End If '*** Windows PowerShell *** Title = "Windows PowerShell" strFile = "%windir%\system32\WindowsPowerShell\v1.0\powershell.exe" strArguments = "" strWorkingDirectory = "%HOMEDRIVE%%HOMEPATH%" strIcon = "%windir%\system32\WindowsPowerShell\v1.0\powershell.exe, 0" If objFSO.FileExists(objShell.ExpandEnvironmentStrings(strFile)) Then MyKakunin If Kakunin = 6 Then MySC End If Title = "Windows PowerShell ISE" strFile = "%windir%\system32\WindowsPowerShell\v1.0\PowerShell_ISE.exe" strArguments = "" strWorkingDirectory = "%HOMEDRIVE%%HOMEPATH%" strIcon = "%windir%\system32\WindowsPowerShell\v1.0\PowerShell_ISE.exe, 0" If objFSO.FileExists(objShell.ExpandEnvironmentStrings(strFile)) Then MyKakunin If Kakunin = 6 Then MySC End If '*** リソース モニター *** Title = "リソース モニター" strFile = "%windir%\system32\perfmon.exe" 'strFile = "%windir%\system32\perfmon.msc" strArguments = "/res" strWorkingDirectory = "" strIcon = "%windir%\system32\wdc.dll, 0" 'strIcon = "%windir%\system32\perfmon.exe, 0" If objFSO.FileExists(objShell.ExpandEnvironmentStrings(strFile)) Then MyKakunin If Kakunin = 6 Then MySC End If 'If InStr(myOS, "Windows 10") > 0 Then ' Title = "Microsoft Edge2" ' strFile = "microsoft-edge:http://d.hatena.ne.jp/palm84/" ' strArguments = "" ' strWorkingDirectory = "" ' strIcon = "%windir%\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\MicrosoftEdge.exe, 0" ' MyKakunin ' If Kakunin = 6 Then ' MySC ' End If 'End If Kakunin = MsgBox ("終了です YO!" & vbcrlf & vbcrlf & "Quick Launch フォルダを開きますか?", 68 ,"クマー! (´・ω・`) ") If Kakunin = 7 Then WScript.Quit End If objShell.Run "%windir%\explorer.exe /e, /root, /select, ""%AppData%\Microsoft\Internet Explorer\Quick Launch""" Set objTxt = Nothing Set objFile = Nothing Set objShortcut = Nothing Set objFSO = Nothing Set objShell = Nothing '********************************************************* 'Sub MyKakunin '********************************************************* Sub MyKakunin Kakunin = MsgBox (Title & " のショートカットを作りますのん? (´・ω・`)", 35 ,"クイック起動にショートカットを作るYO! (´・ω・`) ") If Kakunin = 2 Then WScript.Quit End If 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