How do I create a Delayable count down msg box, which triggers bat file

后端 未结 3 1079
清酒与你
清酒与你 2021-01-07 07:37

Hi I\'m attempting to create a Message box with a \"DELAY\" button If the user does not press the Delay button the script will launch a batch file (or command)

So it

3条回答
  •  温柔的废话
    2021-01-07 07:46

    Save this as a .bat file:

    @if (@CodeSection == @Batch) @then
    
    @echo off
    CScript //nologo //E:JScript "%~F0"
    if %errorlevel% equ -1 (
       echo The user NOT confirmed, proceed to auto-destruction!
    ) else (
       echo Continue normally...
    )
    pause
    goto :EOF
    
    @end
    
    WScript.Quit(WScript.CreateObject("WScript.Shell").Popup(
       "This program will proceed to auto-destruction\nunless you press OK in 10 seconds",
       10,"Popup Title",48))
    

    The 10 is the number of seconds, the 48 the type of icon shown (an exclamation mark in this case), but you may modify it as described here.

提交回复
热议问题