Option Explicit 'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run 'HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Run 'HKEY_CLASSES_ROOT\.txt 'HKCU\Software\Microsoft\Windows\CurrentVersion\Run 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run 'HKU\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Run 'HKCR\.txt Dim objShell Set objShell = WScript.CreateObject("WScript.Shell") Dim strPath, strRegPath, strInput strPath = "Software\Microsoft\Windows\CurrentVersion\Applets\Regedit\LastKey" myInput strRegPath = "マイ コンピュータ\" & strInput objShell.RegWrite "HKCU\" & strPath, strRegPath, "REG_SZ" Dim strComputer 'ホスト名(ローカル コンピュータ) 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 Call objShell.Run( "regedit", , True ) Set objShell = Nothing '********************************************************* 'Sub myInput '********************************************************* Sub myInput strInput = InputBox("パスを入力してください", "指定パスで Regeditを起動") strInput = Replace(strInput, "HKCU", "HKEY_CURRENT_USER") strInput = Replace(strInput, "HKLM", "HKEY_LOCAL_MACHINE") strInput = Replace(strInput, "HKU", "HKEY_USERS") strInput = Replace(strInput, "HKCR", "HKEY_CLASSES_ROOT") End Sub