title: Get the current path of the .bat file within the same .bat file
body: <p>I am trying to create a windows service of some <strong>.exe</strong> file by using <strong>.bat</strong> file. As far as I know I need to use the path of the <strong>.exe</strong> file i want to run as service. But in generally the path of <strong>.exe</strong> file can be different, so I cannot use static path in the <strong>.bat</strong> file. I can solve the part of my problem by placing <strong>.exe</strong> and <strong>.bat</strong> files in the same direction, but I need to somehow get the direction of the <strong>.bat</strong> file  within itself and add the name of my <strong>.exe</strong> file. It is just an idea so is it possible to do it in <strong>.bat</strong> file ?</p>
  
  <p>Thank you</p>
  
  <p>P.S.</p>
  
  <p>To run .exe as a windows service, I use .bat file with the following script</p>
  
  <pre><code>SC create MyService displayname= "MyService" binpath= "&lt;path of exe&gt;\NAME.exe" start= auto
  
  SC failure MyService reset= 86400 actions= restart/1000/restart/1000/run/1000
  
  sc failure MyService command= "\"&lt;path of exe&gt;\NAME.exe""
  </code></pre>