title: Windows 7: Running application using App Paths vs Batch File
body: <p>I have an (PowerBuilder) application (let's call it MyApp.exe) in a folder with a sub-directory that has all the required dlls. I am able to run this application, by adding the application path and associated path variable to Windows App Paths registry key.</p>
  
  <pre><code>[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths\MyApp.EXE]
  "Path"="C:\\Prog32\\MyAPP;C:\\Prog32\\MyAPP\\DLL\\;"
  @="C:\\Prog32\\MyApp\\MyApp.EXE"
  </code></pre>
  
  <p>The above runs file. I didn't even have to register DLLs.</p>
  
  <p>If possible, I would like to run it using a batch file though, as users may install multiple versions of the same application in separate folders. When I tried to do the same thing in a batch file, it cannot find the DLLs.</p>
  
  <pre><code>@SETLOCAL
  SET CURDIR=%~dp0
  CD %CURDIR%
  PUSHD %CURDIR%
  
  SET PATH=%CURDIR%;%CURDIR%\dll;%PATH%
  start "" %CURDIR%\myApp.exe
  POPD
  
  ENDLOCAL
  </code></pre>
  
  <p>I created this batch in the same directory as the executable, MyApp.exe. I was expecting it would find the DLLs, same way App Paths PATH setting did. The Batch file errors out not being able to find the DLLs. Do we need to register DLLs in this case? Why is it treated differently?</p>
  
  <p><strong>Notes:</strong> </p>
  
  <ol>
  <li><p>If I copied all the required DLLs to the same directory as the executable (without a DLL sub-directory), it runs fine without needing to worry about PATH or registering dlls.</p></li>
  <li><p>We used to use installShield to install before, but admins have automated scripts to copy files, they shied away from InstallShield programs after the first install. I am trying to refine the process, so what they copy will be simplified.</p></li>
  </ol>
  
  <p>Thanks in advance for all your valuable comments and suggestions.-Sam</p>