1.

Solve : DOS: PATH cmd to run EXE files - DLL file reference?

Answer»

I am trying to run an EXE (within DOS) from a directory that doesnt have the EXE in it.
So I use the PATH C:/.... command to 'reference' the directory where the EXE file is located.
DOS is then able to find the EXE file to execute.

Unfortunately the EXE file doesnt work PROPERLY, as it can't find DLL files it needs (which were also in the'referenced' directory, and not in the directory I am running the EXE file from).
I cant edit the EXE file as it is a commercial software program.

Is there any way around this? or is the only answer to copy the DLLs into the directory I am running from?

Hope that makes sense. Is there any reason why you can't cd to the directory the .exe is in? I.e.

Code: [Select]cd "c:\program files\someprogram"
start someprogram.exe
Quote from: cmpmike on October 12, 2011, 04:35:37 AM

Unfortunately the EXE file doesnt work properly, as it can't find DLL files it needs

If an exe file requires a DLL or DLLs Windows Windows first searches the set of pre-installed DLLs such as the performance library (KERNEL32.DLL) and the security library (USER32.DLL). Windows then searches for the DLLs in the following sequence:

    The directory where the executable module for the current process is located.
    The current directory.
    The Windows system directory.
    The Windows directory.
    The directories listed in the PATH environment variable.

So put the DLL or DLLs SOMEWHERE where Windows can find them.
Sounds to me like a paid app is being re-engineered to be made to run...
What app is this and why does the .exe not exist in the app folder ? ? Quote from: cmpmike on October 12, 2011, 04:35:37 AM
I am trying to run an EXE (within DOS) from a directory that doesnt have the EXE in it.

Why?
Why? - I need to run the EXE file from a job specific directory as it creates a heap of files in the root directory.
CD to directory? - same as above.
Using Path command? - this is in the MSDOS operating environment, not windows.
App specific? - it is a specific stand along app with one EXE file and a heap of DLL files, I dont want to mess up the softward directory with a thousand job files.

Does anyone have an answer? or Is it simply not possible.?With all of the restrictions you have described, I'm going to say you're looking at a not possible here. It MIGHT work if you could set up a dummy file and use the assoc and ftype commands to start the program from it's directory, but you are looking at a long shot and I'm pretty sure that isn't going to work either. I would stick with your original answer and copy the .dll files to the job specific directory. Write the batch file to delete the .dll files when done. That's about the best you can do at this point.Given the parameters at work here i don't think we should be assisting... Quote from: Salmon Trout on October 12, 2011, 10:46:40 AM
pre-installed DLLs such as the performance library (KERNEL32.DLL) and the security library (USER32.DLL).

Kernel32 is the base API (memory management, forward declarations to ntdll.dll). user32 is user interface stuff (Window and desktop management, arrangement, the default window procedure, etc).

Aside from that nitpick though the  actual order is CORRECT. Although...

Quote
Using Path command? - this is in the MSDOS operating environment, not windows.
What does this even mean? If it is a DOS program that uses overlays or DLLs than it doesn't use the windows search order and typically only searches in predefined locations, almost always only the current directory.
Quote from: cmpmike on October 12, 2011, 04:42:29 PM
Using Path command? - this is in the MSDOS operating environment, not windows.

MSDOS doesn't use DLLs. You must be talking about Windows command line environment.

Quote from: BC_Programmer
Aside from that nitpick though the  actual order is correct.

Blame Microsoft - that's where I copied it from!

http://msdn.microsoft.com/en-us/library/7d83bc18%28v=vs.71%29.aspx

Quote
Search Path Used by Windows to Locate a DLL

With both implicit and EXPLICIT linking, Windows first searches the set of pre-installed DLLs such as the performance library (KERNEL32.DLL) and the security library (USER32.DLL). Windows then searches for the DLLs in the following sequence:

    The directory where the executable module for the current process is located.
    The current directory.
    The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.
    The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.
    The directories listed in the PATH environment variable.

        Note   The LIBPATH environment variable is not used.
Quote from: cmpmike on October 12, 2011, 04:42:29 PM
Using Path command? - this is in the MSDOS operating environment, not windows.

Both Windows command line and MS-DOS - they are not the same thing - use the PATH command, so I'm not sure why you wrote that.

What version of MS-DOS are you talking about? You can check this by typing VER at the prompt and hitting Enter.

Quote
Does anyone have an answer?

Best not to post remarks like that, no matter how impatient you are. The level of joining and posting fees you paid determine the level of service you are assured of getting.

Quote
or Is it simply not possible.?

Is it almost certainly possible but we need better and more accurate information from you. It is certainly interesting that you refuse to say what the software application is.
Quote from: Salmon Trout on October 13, 2011, 12:00:49 AM
Blame Microsoft - that's where I copied it from!
I know. Surprised they haven't fixed that yet.


Discussion

No Comment Found