Board logo

标题: ][ vbs 读注册表,写入一个 .txt [打印本页]

作者: ooaf     时间: 2007-12-24 17:56    标题: ][ vbs 读注册表,写入一个 .txt

=

.bat 中 reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v  360 >run.txt

如何用.vbs 实现 上述内容? 就是把 360 项的值内容 写到 run.txt中

另外,如何用.vbs 添加 注册表的默认项 ? 如:
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{BD96C556-65A3-11D0-983A-00C04FC29E33}\InprocServer32]
@="C:\\Program Files\\Common Files\\System\\shell32\\shell32.dll"

=
作者: HAT     时间: 2007-12-24 18:12

'注册表读取
Set MyReg=WScript.CreateObject("WScript.Shell")
MyRun=MyReg.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\ccApp")
WScript.Echo MyRun

'注册表添加
MyPath="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\MyTest"
Set MyReg=WScript.CreateObject("WScript.Shell")
MyRun=MyReg.RegWrite(MyPath,"C:\test.bat")

'注册表删除
MyPath="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\MyTest"
Set MyReg=WScript.CreateObject("WScript.Shell")
MyRun=MyReg.RegDelete(MyPath)

作者: ooaf     时间: 2007-12-25 10:51
=
谢了 !
我找到了:
cho Set WshShell = Wscript.CreateObject("Wscript.Shell")>tem.vbs
echo tt=WshShell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\user Shell Folders\startup")>>tem.vbs
echo set fso=createobject("scripting.filesystemobject")>>tem.vbs
echo set fil=fso.opentextfile("%temp%\path.txt",2,true)>>tem.vbs
echo fil.write tt>>tem.vbs
echo fil.close>>tem.vbs
echo set fil=nothing>>tem.vbs
echo set fso=nothing>>tem.vbs
echo set WshShell=nothing>>tem.vbs
call "tem.vbs"
for /f "tokens=*" %%i in (%temp%\path.txt) do ( call echo "%%i")

另外,如何用.vbs 添加 注册表的默认项 ? 如:
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{BD96C556-65A3-11D0-983A-00C04FC29E33}\InprocServer32]
@="C:\\Program Files\\shell32.dll"

=

[ Last edited by ooaf on 2007-12-25 at 10:53 AM ]