标题: VBS脚本查询Windows注册信息 [打印本页]
作者: ieutk 时间: 2007-12-25 18:11 标题: VBS脚本查询Windows注册信息
对VBS不懂,发一个自己收藏的脚本
- dim wshshell,doit
- dim regowner,regorg,proname,prokey,prover,pathname
- 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
- set wshshell=wscript.createobject("wscript.shell")
- regpath="HKLM\Software\Microsoft\Windows NT\CurrentVersion\"
- '******************从注册表读取当前注册信息的子过程*********************
- sub read_21pcinfo()
- regowner=wshshell.regread(regpath+"registeredOwner")
- regorg=wshshell.regread(regpath+"RegisteredOrganization")
- proname=wshshell.regread(regpath+"ProductName")
- prokey=wshshell.regread(regpath+"ProductID")
- prover=wshshell.regread(regpath+"CurrentBuildNumber")
- pathname=wshshell.regread(regpath+"PathName")
- end sub
- '******************显示当前注册信息的子过程*********************
- sub disp_21pcinfo()
- call read_21pcinfo()
- msgchr=chr(13)&chr(10)+" "
- program_name="Windows 注册信息查询脚本"
- reg_prompt1="当前"+proname+"的注册信息"
- reg_prompt2="您是否需要修改当前的注册信息? "
- 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)
- if doit = vbcancel then
- wscript.quit
- else
- call reset_21pcinfo
- end if
- end sub
- sub reset_21pcinfo()
- input_regowner="请您输入新的注册用户名称: "
- input_regorg="请您输入新的注册单位名称: "
- input_prover="请您输入新的产品版本号: "
- input_prokey="请您输入新的产品ID号: "
- input_title="修改注册信息"
- your_input_21pcinfo="您输入的注册信息是: "
- affirm_input_21pcinfo="您确认修改这些信息吗? "
- '以上是设置字符串变量的值
- re_regowner=inputbox(input_regowner,input_title)
- re_regorg=inputbox(input_regorg,input_title)
- re_prover=inputbox(input_prover,input_title)
- re_prover=inputbox(input_prokey,input_title)
- '从输入对话框中获取用户输入的新注册信息
- 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,"确认修改")
- if doit = vbcancel then
- wscript.quit
- else
- wshshell.regdelete(regpath+"registeredowner")
- wshshell.regdelete(regpath+"registeredorganization")
- wshshell.regdelete(regpath+"CurrentBuildNumber")
- wshshell.regdelete(regpath+"ProductID")
- wshshell.regWrite regpath+"registeredowner",re_regowner
- wshshell.regWrite regpath+"registeredorganization",re_regorg
- wshshell.regWrite regpath+"CurrentBuildNumber",re_prover
- wshshell.regWrite regpath+"ProductID",re_prokey
- end if
- call disp_21pcinfo
- end sub
- call disp_21pcinfo
复制代码
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |