Board logo

标题: VBS脚本查询Windows注册信息 [打印本页]

作者: ieutk    时间: 2007-12-25 18:11     标题: VBS脚本查询Windows注册信息

对VBS不懂,发一个自己收藏的脚本

  1. dim wshshell,doit
  2. dim regowner,regorg,proname,prokey,prover,pathname
  3. dim msgchr,welcome_inf,program_name,reg_prompt1,reg_prompt2,input_regowner,input_regorg,input_prover,input_prokey,input_title,your_input_21pcinfo,affirm_input_21pcinfo
  4. set wshshell=wscript.createobject("wscript.shell")
  5. regpath="HKLM\Software\Microsoft\Windows NT\CurrentVersion\"
  6. '******************从注册表读取当前注册信息的子过程*********************
  7. sub read_21pcinfo()
  8. regowner=wshshell.regread(regpath+"registeredOwner")
  9. regorg=wshshell.regread(regpath+"RegisteredOrganization")
  10. proname=wshshell.regread(regpath+"ProductName")
  11. prokey=wshshell.regread(regpath+"ProductID")
  12. prover=wshshell.regread(regpath+"CurrentBuildNumber")
  13. pathname=wshshell.regread(regpath+"PathName")
  14. end sub
  15. '******************显示当前注册信息的子过程*********************
  16. sub disp_21pcinfo()
  17. call read_21pcinfo()
  18. msgchr=chr(13)&chr(10)+" "
  19. program_name="Windows 注册信息查询脚本"
  20. reg_prompt1="当前"+proname+"的注册信息"
  21. reg_prompt2="您是否需要修改当前的注册信息? "
  22. doit=msgbox(reg_prompt1+chr(10)+msgchr+"产品名称: "+proname+msgchr+"产品ID: "+prokey+msgchr+"注册用户: "+regowner+msgchr+"注册单位: "+regorg+msgchr+"产品版本: "+prover+msgchr+"安装路径: "+pathname+msgchr+chr(10)+chr(10)+reg_prompt2,vbokcancel + vbinformation,program_name)
  23. if doit = vbcancel then
  24. wscript.quit
  25. else
  26. call reset_21pcinfo
  27. end if
  28. end sub
  29. sub reset_21pcinfo()
  30. input_regowner="请您输入新的注册用户名称: "
  31. input_regorg="请您输入新的注册单位名称: "
  32. input_prover="请您输入新的产品版本号: "
  33. input_prokey="请您输入新的产品ID号: "
  34. input_title="修改注册信息"
  35. your_input_21pcinfo="您输入的注册信息是: "
  36. affirm_input_21pcinfo="您确认修改这些信息吗? "
  37. '以上是设置字符串变量的值
  38. re_regowner=inputbox(input_regowner,input_title)
  39. re_regorg=inputbox(input_regorg,input_title)
  40. re_prover=inputbox(input_prover,input_title)
  41. re_prover=inputbox(input_prokey,input_title)
  42. '从输入对话框中获取用户输入的新注册信息
  43. doit=msgbox(your_input_21pcinfo+chr(10)+msgchr+"注册用户: "+re_regowner+msgchr+"注册单位: "+re_regorg+msgchr+"产品版本: "+re_prover++msgchr+"产品ID: "+re_prokey+chr(10)+chr(10)+affirm_input_21pcinfo,vbokcancel + vbquestion,"确认修改")
  44. if doit = vbcancel then
  45. wscript.quit
  46. else
  47. wshshell.regdelete(regpath+"registeredowner")
  48. wshshell.regdelete(regpath+"registeredorganization")
  49. wshshell.regdelete(regpath+"CurrentBuildNumber")
  50. wshshell.regdelete(regpath+"ProductID")
  51. wshshell.regWrite regpath+"registeredowner",re_regowner
  52. wshshell.regWrite regpath+"registeredorganization",re_regorg
  53. wshshell.regWrite regpath+"CurrentBuildNumber",re_prover
  54. wshshell.regWrite regpath+"ProductID",re_prokey
  55. end if
  56. call disp_21pcinfo
  57. end sub
  58. call disp_21pcinfo
复制代码





欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2