cmd - Input form for batch with HTA -


how can make simple input form in hta , read batch in simple variable, , button proceed. don't know other way make decent gui batch file. this

enter image description here

any appreciated.

in short, need is

  • get reference standard output stream inside .hta file , write output content of field

  • execute .hta batch file using for /f command process data sent standard output.

the "problem" need explicitly call mshta.exe executable full path .hta file.

serialnumber.hta

<html>     <head>         <hta:application              id              = "serialhta"              applicationname = "serialhta"             version         = "0.1"             navigable       = "yes"             showintaskbar   = "yes"              singleinstance  = "yes"              windowstate     = "normal"              border          = "normal"              borderstyle     = "normal"             innerborder     = "no"               caption         = "yes"              minimizebutton  = "yes"             maximizebutton  = "yes"             sysmenu         = "yes"              scroll          = "yes"              scrollflat      = "yes"              contextmenu     = "yes"             selection       = "yes"         />          <title>input serial number</title>          <script language="javascript">             function closehta(sendoutput){                 if (sendoutput){                     (new activexobject('scripting.filesystemobject'))                         .getstandardstream(1)                         .writeline(                             document.getelementbyid('serialnumber').value                         );                 };                 window.close();             }         </script>      </head>      <body>         <label for="serialnumber">serial:</label>         <input type="text" id="serialnumber">         <br>         <button onclick="closehta(true);">ok</button>         <button onclick="closehta();">cancel</button>     </body>  </html> 

serialnumber.cmd

@echo off     setlocal enableextensions disabledelayedexpansion      set "serialnumber="     /f "delims=" %%a in ('mshta.exe "%~dp0\serialnumber.hta"') set "serialnumber=%%a"      if defined serialnumber (         echo serial number: %serialnumber%     ) else (         echo no serial number provided     ) 

Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -