title: passing parameters from javascript function to batch file
body: <p>I am trying to create a html page for client from which he'll be able to start or stop a particular window service on any remote desktop. Total no. of services in scope are around 20. Rather than creating 20(start) + 20(stop) + 20(restart) batch file, i want to have 1 batch file with if else condition, I could pass parameter in javascript function. Code for html page is below :</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;   
  &lt;html&gt;
  &lt;head&gt;
  &lt;script type="text/javascript"&gt;
  MyObject = new ActiveXObject("WScript.Shell")
  function start()
  {
  MyObject.Run("\"E:\\start.bat\"");
  }
  function stop()
  {
  MyObject.Run("\"E:\\stop.bat\"");
  }
  function restart()
  {
  MyObject.Run("\"E:\\restart.bat\"");
  }
  &lt;/script&gt;
  &lt;title&gt;Our Company&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;table background-color:#f1f1c1; border="1" style="width:50%" align="center"&gt;
  &lt;tr&gt;
  &lt;th style="text-align:center"&gt;Instance Name&lt;/th&gt;
  &lt;th style="text-align:center"&gt;Accessible URL&lt;/th&gt; 
  &lt;th style="text-align:center"&gt;Status&lt;/th&gt;
  &lt;th style="text-align:center"&gt;Start&lt;/th&gt;
  &lt;th style="text-align:center"&gt;Stop&lt;/th&gt;
  &lt;th style="text-align:center"&gt;Restart&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr height="70%"&gt;
  &lt;td style="text-align:center"&gt;netadds&lt;/td&gt;
  &lt;td style="text-align:center"&gt;
  &lt;a href="http://localhost/"&gt;localhost:netadds&lt;/a&gt;&lt;/td&gt; 
  &lt;td style="text-align:center"&gt;Running&lt;/td&gt;
  &lt;td style="text-align:center"&gt;&lt;button onclick="start()"&gt;Start&lt;/button&gt;&lt;/td&gt;
  &lt;td style="text-align:center"&gt;&lt;button onclick="stop()"&gt;Stop&lt;/button&gt;&lt;/td&gt;
  &lt;td style="text-align:center"&gt;&lt;button onclick="restart()"&gt;Restart&lt;/button&gt;          &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and code in start.bat is :</p>
  
  <pre><code>@echo off
  net start AMAPTestJetty8i0T1
  if ERRORLEVEL 1 goto error
  exit
  :error
  echo Could not start service
  pause
  </code></pre>
  
  <p>Please suggest how can I apply if else statement in batch and pass parameter in start function.</p>