title: Get exe name next to batch file
body: <p>I have used this batch script to create shortcut of an <code>.exe</code> but I want to get the <code>.exe</code> name also dynamically. In a folder I have batch file and also one <code>.exe</code> file I want to get that <code>.exe</code> name dynamically in my batch file.</p>
  
  <pre><code>@echo off
  
  set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
  
  echo Set oWS = WScript.CreateObject("WScript.Shell") &gt;&gt; %SCRIPT%
  echo sLinkFile = "%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\Player111.lnk" &gt;&gt; %SCRIPT%
  echo Set oLink = oWS.CreateShortcut(sLinkFile) &gt;&gt; %SCRIPT%
  echo oLink.TargetPath = "%CD%\Pacman.exe" &gt;&gt; %SCRIPT%
  echo oLink.Save &gt;&gt; %SCRIPT%
  
  cscript /nologo %SCRIPT%
  del %SCRIPT%
  </code></pre>
  
  <p>I want to set <code>oLink.TargetPath</code> dynamically. It will be the path where the batch file located along with the <code>.exe</code> name. How can I get <code>Pacman.exe</code> as mentioned in above code dynamically? Remember, exactly one <code>.exe</code> is in the folder.</p>