Option Explicit '指定パスで Regeditを起動" 'HKCU\Software\Microsoft\Windows\CurrentVersion\Run 'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run 'HKU\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Run 'HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Run 'HKCR\.txt 'HKEY_CLASSES_ROOT\.txt 'HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit\Favorites 'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit\Favorites Dim objShell Set objShell = WScript.CreateObject("WScript.Shell") Const strPath = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit\LastKey" Dim strInput strInput = myInput Dim strRegPath strRegPath = strInput objShell.RegWrite strPath, strRegPath, "REG_SZ" Const strComputer = "." 'ホスト名(ローカル コンピュータ) Dim objWMIService, colProcessList,objProcess Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process Where Name = 'regedit.exe'") For Each objProcess in colProcessList objProcess.Terminate() Next Set objWMIService = Nothing objShell.Run "regedit.exe" Set objShell = Nothing '********************************************************* 'Function myInput '********************************************************* Function myInput() myInput = InputBox("パスを入力してください", "指定パスで Regeditを起動") If IsEmpty(myInput) Then WScript.Quit If myInput = "" Then myInput End If myInput = Replace(myInput, "HKCU", "HKEY_CURRENT_USER") myInput = Replace(myInput, "HKLM", "HKEY_LOCAL_MACHINE") myInput = Replace(myInput, "HKU", "HKEY_USERS") myInput = Replace(myInput, "HKCR", "HKEY_CLASSES_ROOT") End Function