- 帖子
- 754
- 积分
- 971
- 技术
- 4
- 捐助
- 0
- 注册时间
- 2021-8-30
|
[问题求助] 【已解决】怎样将获取注册表SID的bat文件vbs文件?
本帖最后由 yyz219 于 2021-12-25 08:51 编辑
完美解决了
复制【sid】(默静}。vbs
'【获取“注册表sid,并生成“注册表数字串.txt”文件】
set path=wscript.createobject("wscript.shell")
name=path.ExpandEnvironmentStrings("%username%")
strComputer = "."
Set wbemServices = Getobject("winmgmts:\\" & strComputer)
Set wbemObjectSet=wbemServices.execquery("select sid from win32_userAccount where name='"&name&"'")
For Each mo In wbemObjectSet
sSID = mo.sid
Next
If(sSID = "")Then
Else
set fso = CreateObject("Scripting.FileSystemObject")
currentpath = createobject("Scripting.FileSystemObject").GetFolder(".").Path
set f = fso.CreateTextFile(currentpath&"\"&"注册表数字串.txt", true)
f.Write sSID
f.Close()
set f = nothing
set fso = nothing
End If
'【复制“注册表数字串.txt”里面内容到剪切板】
set ws=createobject("wscript.shell")
set fso=createobject("scripting.filesystemobject")
set f=fso.opentextfile("注册表数字串.txt",1)
ws.run "mshta vbscript:ClipBoardData.setData(""Text"","""&f.readall&""")(window.close)", 0, true
createobject("wscript.shell").run "cmd /c del 注册表数字串.txt",0 '【删除:注册表数字串.txt】
CreateObject("WScript.Shell").Run "cmd /c D:\1绿色软件\bat批处理\已经复制.bat",1 '【 行末尾的 ,0表示隐藏窗口】 |
|