Cmd提示计时器窗口弹出窗口

时间:2015-02-11 02:25:16

标签: batch-file timer popupwindow messagewindow

如何使用批处理文件打开具有计时器的消息窗口? 我正在尝试创建一个打开命令提示符的批处理文件,并在执行2个命令后弹出一个带有计时器的消息,其中显示自解压...然后播放声音,然后关闭 这是我到目前为止所拥有的

:cmd
set /p cmd=command:

%cmd%
echo.
goto  cmd2

:cmd2

set /p cmd=command:

%cmd%
echo.

1 个答案:

答案 0 :(得分:2)

试试这个 - 它只接受一个参数 - 倒数秒。应该用.bat扩展名保存:

<!-- :
:: countdown.bat
@echo off

if "%~1" equ "" (
  echo seconds not passed
  exit /b 1
)

echo %*|mshta.exe "%~f0"|more



exit /b %errorlevel%
-->

<html>
<head><title>It's the final countdown</title></head>
<body>

<p>Seconds left</p>
<div id="countdown">--</div>
<button onclick='quit()'>QUIT</button>
    <script language='javascript' type="text/javascript">
        function parse() {
               var seconds=0;
               try {
                  var fso2= new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(0);
                  argline=fso2.ReadLine();
                  var args=argline.split(" ");
                  var seconds=parseInt(args[0]);
                  //var fso= new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1);
                  //fso.Write("wait for: " + milliseconds);
               } catch (err) {
                  errmessage = "cannot get the milliseconds";
                  var fso= new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1);
                  fso.Write(errmessage);
                  close();
               }
               seconds = document.getElementById('countdown').innerHTML=seconds;
               countdown();
        }

  var seconds;
  var temp;

  function countdown() {
    seconds = document.getElementById('countdown').innerHTML;
    seconds = parseInt(seconds, 10);

    if (seconds == 1) {
      temp = document.getElementById('countdown');
      close();
      //return;
    }

    seconds--;
    temp = document.getElementById('countdown');
    temp.innerHTML = seconds;
    timeoutMyOswego = setTimeout(countdown, 1000);
  } 

  //countdown();
  window.resizeTo(400,250)
  parse();

        function quit() {
            close();
        }
        //itsTheFinalCountdown(10000);
    </script>
</body>

</html>