title: Getting Pid of cmd while running batch script
body: <p>This should be quite simple but I didn`t manage to find it.</p>
  
  <p>If I am running some batch script in cmd, how do I get process id of the hosting cmd?</p>
  
  <pre><code>set currentCmdPid= /* some magic */
  echo %currentCmdPid%
  </code></pre>
  
  <p>I have found a lot of solutions that use <code>tasklist</code> and name filtering but I believe that this won`t work for me, since there can be launched many instances of cmd.</p>
  
  <p>Again, I`d like to have some simple elegant and bullet-proof solution.</p>
  
  <p>Thanks.</p>