I am having a weird problem with the PATH variable under windows:
My application is in a folder c:\app\bin and the DLLs for this application are in the c:\app\runtime folder. To run my program I modify the PATH variable with a *.bat file usually with the following script:
set PATH="c:\app\bin";"c:\app\runtime";%PATH%
This will bring the executables and the DLLs on the path. However, on one of my Windows Server 2008 R2 systems this does not work. That means, if I execute the above command in a command window, I can start the exe file from c:\app\bin, but the application complains immediately that it cannot find some dll files required ("The program can't start because ....dll is missing from your computer ..."). These dll files should be in c:\app\runtime.
I experimented a little bit and it points out that there are three workarounds:
- Modify the PATH variable permanently using the System Properties dialog
- Omit the quotation marks in the above command for the path of the DLL files, e.g. set
PATH="c:\app\bin";c:\app\runtime;%PATH%
- Copying the DLL files to the directory where the exe is located
The weird part about solution 2 is, that it does not change anyhing if I add quotation marks to the first path, or if I change the order of the paths.
Has someone a clue why my original script does not work? I need to get it run, because it is created automatically by a program and I cannot change the application that generates the bat file.
The
PATH
variable doesn't ordinarily contain quotes; it uses semicolons as its delimiter. For example, here is my system'sPATH
definition, which includes folders with spaces:It seems that Windows can execute programs with "quoted" paths, but the DLL search routine can't handle them.
Ideally you should use:
Another workaround might be to launch the program from
c:\app\runtime
, eg:That may not even require modifying the
PATH
variable.This happens when you paste in a path value with TWO or more paths separated by a COLON instead of pasting them into the dialog one at a time. I had the same issue.
Your Solutions:
Click OK OK then relaunch your terminal editor to load the new values.
Hope that helps!