# encoding: ascii
# api: xml
# title: visual cmd\bat
# description: save script with .cmd or .bat extension and launch. this demo just shows current directory entries.
# version: 0.1
# type: script
# author: greg zakharov
# license: CC0
# x-poshcode-id: 5654
# x-archived: 2015-01-04T10:40:34
# x-published: 2015-12-27T19:01:00
#
#
<!-- :
@echo off
  setlocal
    start "" mshta.exe "%~f0"
  endlocal
exit /b
-->

<!DOCTYPE html>
<html>
  <head>
    <title>Visual CMD\BAT</title>
    <style type="text/css">
      body { font-family: tahoma; margin: 0 5; padding: 0; }
      p { margin: 0; padding: 0; }
    </style>
    <script language="JScript">
      function resize() { window.window.resizeTo(300, 300); }
    </script>
  </head>
  <body onload="resize();">
    <script>
      (function() {
        var std, arr, i;
        with (new ActiveXObject('WScript.Shell')) {
          std = Exec('cmd /q /k echo off');
          std.StdIn.WriteLine('dir /b & exit');
          arr = std.StdOut.ReadAll().split('\n');
          
          for (i = 0; i < arr.length; i++) {
            document.write('<p>' + arr[i] + '</p>');
          } //for
        }
      }());
    </script>
  </body>
</html>
