Dim WshShell, nameKey(2), rKey(2), iPos, iCnt, wKey(2), oEcho, cKey, iRet Set WshShell = WScript.CreateObject("WScript.Shell") nameKey(0) = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\npkcrypt\ImagePath" nameKey(1) = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\npkcrypt\ImagePath" nameKey(2) = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Services\npkcrypt\ImagePath" For iCnt = 0 To 2 rKey(iCnt) = WshShell.RegRead(nameKey(iCnt)) wKey(iCnt) = rKey(iCnt) iPos = InStr(rKey(iCnt),":\") If iPos > 1 Then iPos = iPos - 1 cKey = Mid(rKey(iCnt),iPos,1) ' WScript.Echo iPos ' WScript.Echo cKey ' WScript.Echo Asc(cKey) If (Asc(cKey) >= Asc("A")) And (Asc(cKey) <= Asc("Z")) Then wKey(iCnt) = Mid(rKey(iCnt),iPos) ' WScript.Echo wKey(iCnt) ElseIf Asc(cKey) >= Asc("a") And Asc(cKey) <= Asc("z") Then wKey(iCnt) = Mid(rKey(iCnt),iPos) ' WScript.Echo wKey(iCnt) Else ' WScript.Echo "error" End If End If Next oEcho = "" For iCnt = 0 To 2 oEcho = oEcho & "パス:" & nameKey(iCnt) & vbNewLine oEcho = oEcho & "変更前:" & rKey(iCnt) & vbNewLine oEcho = oEcho & "変更後:" & wKey(iCnt) & vbNewLine oEcho = oEcho & vbNewLine If wKey(iCnt) <> "" Then End If Next 'WScript.Echo oEcho iRet = MsgBox(oEcho & "変更しますか?",vbOKCancel) If iRet = vbOK Then For iCnt = 0 To 2 WshShell.RegWrite nameKey(iCnt), wKey(iCnt), "REG_EXPAND_SZ" Next iRet = MsgBox(oEcho & "変更しました",vbOKOnly) Else iRet = MsgBox("変更しませんでした",vbOKOnly) End If