gpt4 book ai didi

vbscript - VBS 脚本 - 需要将 msgbox 更改为 echo

转载 作者:行者123 更新时间:2023-12-01 19:58:46 31 4
gpt4 key购买 nike

我很难将此脚本转换为 echo 而不是 msgbox 输出。

我需要输出进入 C:\key.log 中的文本文件,而不是带有 key 的消息框。

有人知道该怎么做吗?谢谢!

Set WshShell = CreateObject("WScript.Shell")
MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))

Function ConvertToKey(Key)
Const KeyOffset = 52
i = 28
Chars = "BCDFGHJKMPQRTVWXY2346789"
Do
Cur = 0
x = 14
Do
Cur = Cur * 256
Cur = Key(x + KeyOffset) + Cur
Key(x + KeyOffset) = (Cur \ 24) And 255
Cur = Cur Mod 24
x = x -1
Loop While x >= 0
i = i -1
KeyOutput = Mid(Chars, Cur + 1, 1) & KeyOutput
If (((29 - i) Mod 6) = 0) And (i <> -1) Then
i = i -1
KeyOutput = "-" & KeyOutput
End If
Loop While i >= 0
ConvertToKey = KeyOutput
End Function

最佳答案

尝试这样:

Option Explicit
Dim WshShell,RegKey,WindowsKey,LogFile,fso
Set WshShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
RegKey = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"
WindowsKey = ConvertToKey(WshShell.RegRead(RegKey))
LogFile = "c:\key.log"
if fso.FileExists(LogFile) Then
fso.DeleteFile LogFile
end If
MsgBox WindowsKey,VbInformation,WindowsKey
Call WriteLog(WindowsKey,LogFile)
WshShell.Run LogFile
'***********************************************************************************************************
Function ConvertToKey(Key)
Const KeyOffset = 52
Dim i,Chars,Cur,x,KeyOutput
i = 28
Chars = "BCDFGHJKMPQRTVWXY2346789"
Do
Cur = 0
x = 14
Do
Cur = Cur * 256
Cur = Key(x + KeyOffset) + Cur
Key(x + KeyOffset) = (Cur \ 24) And 255
Cur = Cur Mod 24
x = x -1
Loop While x >= 0
i = i -1
KeyOutput = Mid(Chars, Cur + 1, 1) & KeyOutput
If (((29 - i) Mod 6) = 0) And (i <> -1) Then
i = i -1
KeyOutput = "-" & KeyOutput
End If
Loop While i >= 0
ConvertToKey = KeyOutput
End Function
'*************************************************************************************************************
Sub WriteLog(strText,LogFile)
Dim fs,ts
Const ForAppending = 8
Set fs = CreateObject("Scripting.FileSystemObject")
Set ts = fs.OpenTextFile(LogFile,ForAppending,True)
ts.WriteLine strText
ts.Close
End Sub
'**************************************************************************************************************

关于vbscript - VBS 脚本 - 需要将 msgbox 更改为 echo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29662785/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com