キーの存在チェックを行いたいのですが
VBScript
1'■===キーの存在チェック=== 2Function JOB_Key_Check() 3 dim bExists 4 ssig="Unable to open registry key" 5 set wshShell= CreateObject("WScript.Shell") 6 strKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\インストールしたキー\" 7 on error resume next 8 present = WshShell.RegRead(strKey) 9 if err.number<>0 then 10 if right(strKey,1)="\" then 11 if instr(1,err.description,ssig,1)<>0 then 12 bExists=true 13 else 14 bExists=false 15 end if 16 else 17 bExists=false 18 end if 19 err.clear 20 else 21 bExists=true 22 end if 23 on error goto 0 24 if bExists=vbTrue then 25 msgbox("存在します") 26 else 27 msgbox("存在しません") 28 end if 29End Function
このようなソースでエラーが出なかった場合に存在すると判断しているのですが、
ある端末でインストールを行うとキーが「存在します」とメッセージが出て、
別の端末ではインストール後、チェックしているキーが存在していても「存在しません」と出てしまう。
原因が分からないのですが、わかる方がいたら教えていただけないでしょうか?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/09/22 08:10