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

I need each one to pop its own message box, so when I click OK it moves to the next one and then the next one. At the end it saves all as a text document on the desktop. Currently being used in a .bat but if .vbs would be easier or better please tell me what code to use.

I have tried including msgbox, but not sure how to set the different codes with each box. I have tried to reverse engineer: Set WshShell = CreateObject("WScript.Shell") MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId") But no such luck

Arodger
  • 9
  • 2
  • Not in the habit of telling people *"what code to use"* would prefer you post what you have tried and try and help you work towards a solution yourself. – user692942 Mar 24 '16 at 11:47
  • All useful information that should be [added to](http://stackoverflow.com/posts/36198750/edit) the initial question. – user692942 Mar 24 '16 at 12:15
  • 1
    Duplicate of [Show a popup/message box from a Windows batch file](http://stackoverflow.com/q/774175/692942) – user692942 Mar 24 '16 at 13:11
  • 1
    I don't get, why it should be easier to click on a `yes` button than to hit on any key... – Stephan Mar 24 '16 at 15:22

1 Answers1

2

Try like this way :

@echo off
Set Title="Example of MsgBox by Hackoo"
Set TmpFile=Tmp.txt
Set LogFile=%UserProfile%\Desktop\result.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
user692942
  • 16,398
  • 7
  • 76
  • 175
Hackoo
  • 18,337
  • 3
  • 40
  • 70
  • No explanation at all yet again...ok it may be obvious to us what `msg.vbs` will do but not everyone. – user692942 Mar 24 '16 at 13:08
  • @Lankymart Hmmm i think i guess knowing who downvote to all my answers :) – Hackoo Mar 24 '16 at 13:31
  • What I haven't down-voted anything, what are you on about? I do think however that *some* of your answers while technically correct suffer from lack of detailed explanation. – user692942 Mar 24 '16 at 14:02
  • @Lankymart i edit my answer and i comment it, and don't forget this time to upvote it ! (-_°) Thank you man for your fair play ! – Hackoo Mar 24 '16 at 15:24
  • Ok, so that code does work fairly well minus the few empty message boxes. I don't know a lot about coding i usually just save samples and mess around with them. Thanks!! – Arodger Mar 25 '16 at 00:40