运行批处理时创建消息框


@echo off
wmic csproduct get uuid
pause
wmic DISKDRIVE get SerialNumber
pause
getmac
pause

我需要每个弹出自己的消息框,所以当我单击"确定"时,它会移动到下一个,然后是下一个。最后,它将所有内容另存为桌面上的文本文档。目前正在.bat中使用,但如果.vbs更容易或更好,请告诉我使用什么代码。

我尝试过包括 msgbox,但不确定如何为每个框设置不同的代码。我尝试逆向工程: Set WshShell = CreateObject("WScript.Shell"( MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"( 但没有这样的运气

尝试这样:

@echo off
Set Title="Example of MsgBox by Hackoo"
Set TmpFile=Tmp.txt
Set LogFile=%UserProfile%Desktopresult.txt
(
    for /f "delims=" %%G in ('wmic csproduct get uuid') do (echo "%%G" & Call:MsgBox "%%G" ,vbInformation,%Title%)
    for /f "delims=" %%G in ('wmic diskdrive get SerialNumber') do (echo "%%G" & Call:MsgBox "%%G" ,vbInformation,%Title%)
    for /f "delims=" %%G in ('getmac') do (echo %%G & Call:MsgBox "%%G" ,vbInformation,%Title%)
)>%TmpFile%
Cmd /U /C Type %TmpFile% > %LogFile%
Start "" %LogFile%
Del %TmpFile%
Exit /b
:MsgBox <Message> <Buttons Type> <Title>
Rem This function create a vbscript file %tmp%Msg.vbs with 3 arguments and executes it
Rem First argument is %1 ==> To show the message
Rem Second argument is %2 ==> To choose the type of buttons
Rem Third argument is %3 ==> To show the Title
Rem Example how we can call this function :
Rem Call :MsgBox "This an example from Hackoo to say Hello to ""stackoverflow.com"" ",vbInformation,%Title%
Rem Call :MsgBox "This an example from Hackoo to show any kind of a Warning Message",vbExclamation,%Title%
Rem Call :MsgBox "This an example from Hackoo to show any kind of error",vbCritical,%Title%
(
echo MsgBox %1,%2,%3
)>%tmp%Msg.vbs
cscript /nologo %tmp%Msg.vbs
Del %tmp%Msg.vbs

最新更新