Problem with launching programs from current directory

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: Hacker, petermad, Stefan2, white

reflex
Junior Member
Junior Member
Posts: 20
Joined: 2009-01-23, 22:40 UTC

Problem with launching programs from current directory

Post by *reflex »

Scenario:
authotkey is installed - autohotkey.exe is associated with .ahk files.
In some other directory is another autohotkey.exe located - but a different version.

Now i press Ctrl-Enter over this other version to move it down in the command line and start it. Total commander runs now the wrong file -> from the directory where the association points to.

If i make " around the autohotkey.exe, it works and the current directory is used.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

What command line exactly you executing when wrong file is started?
reflex
Junior Member
Junior Member
Posts: 20
Joined: 2009-01-23, 22:40 UTC

Post by *reflex »

it works only with the exe:

autohotkey.exe
"autohotkey.exe"

will not start the version where you are!

"autohotkey.exe "

will start the right version. (blank on the end is needed)
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

By default if you miss full path to EXE it will be searched in current directory. But in your case it looks strange that additional space is needed.

If you have associated some EXE with file type and press Enter, associated program should be started anyway (if it is configured using full path).
reflex
Junior Member
Junior Member
Posts: 20
Joined: 2009-01-23, 22:40 UTC

Post by *reflex »

If you have associated some EXE with file type and press Enter, associated program should be started anyway (if it is configured using full path).
That would mean i can never start any other file with the same name from another location? Are you sure?
In pure command line this works as it should -> starts the exe from current dir.

And file type is not even used here - there is no .ahk file involved...
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

When application is executing file, it is searched in current directory at first, then in directories specified in PATH environment variable. If file with given name is found in current directory, it is started even if files with same name exist in other directories.

You may use full path to start any with same name from any location. And, you may use Ctrl+Shift+Enter to paste full path to TC command line.
reflex
Junior Member
Junior Member
Posts: 20
Joined: 2009-01-23, 22:40 UTC

Post by *reflex »

MVV wrote:If file with given name is found in current directory, it is started even if files with same name exist in other directories.
No, it is not - thats exactly the problem i have. Please try it.

My environment:
WinXP
TC 7.55a
User avatar
HolgerK
Power Member
Power Member
Posts: 5409
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Post by *HolgerK »

Related Topic:
Starting firefox in C:\Program Files instead of...

And i agree: "this is not expected" from command line.

Regards
Holger
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Ok I forgot about registry key with paths for installed applications.
Well, if TC really starts file from another directory even if file with same name exists in current directory - I agree that it is bug.
reflex
Junior Member
Junior Member
Posts: 20
Joined: 2009-01-23, 22:40 UTC

Post by *reflex »

thanks Holger for the related link!

Seems to be the same problem. I'm a little confused how old the thread is and the bug is still there.
And it is clearly a bug - TC is even writing the path on the left of the command line and then it starts from somewhere else? Come on...

If there are really people, who want it like that (i guess 99% dont even know about), then just make it configurable...

I hope it will be fixed soon - i dont want to regret the money i payed for TC (and customs!)
User avatar
karlchen
Power Member
Power Member
Posts: 4605
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Hello, reflex.

If it is the same problem as discussed in the old thread, then the bottom of the problem is not a Total Commander bug, but a design decision:
Windows apparently can override search path and fully qualified executable file names with the help of an entry inside the "App Paths" registry key.
The quesion which has never been discussed and decided upon is whether Total Commander is supposed to respect such an "App Paths" entry or whether it should ignore it.

The workaround is pretty simple: remove the offending "App Paths" entry manually thus restoring the expected search behaviour.

Therefore, calling T.C. unusable because it respects the Windows "App Paths" priority is exaggerated. I doubt that you will get back your registration fee because T.C. respects a Windows priority rule although most of us will consider this rule absurd.

Kind regards,
Karl
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

karlchen, if file to be launched presents in current folder, it must be launched regardless of any PATH or "App Paths". Only if file is not found in current directory TC may look for other paths. If I see file in current directory, type its name - and TC starts another file - it is 100% bug or very bad unlogical behaviour.
reflex
Junior Member
Junior Member
Posts: 20
Joined: 2009-01-23, 22:40 UTC

Post by *reflex »

@karlchen:
You must be kidding!
Are you a responsible developer? Cause then i would demand my registration fee back! What a kind of discussion and solutions!

Do you really think, i mess with the registry, only cause of a buggy program? Do you do that? Do you have admin rights everywhere? Never use TC with USB stick on different machines?

Windows overrides search path? Hä?
If i start a console, enter a filename and this file is present in the current directoy, it will be started. <-Period
And nothing more should happen in TC. What part of that do you dont understand?

I saw already in the old thread some kind of ignorance and 2 years later its the same story?

Why is the developer unable to fix this? This must be 3 lines of code! With a switch maybe 10!
User avatar
karlchen
Power Member
Power Member
Posts: 4605
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Hi, guys.

Cool down. As I stated I agree with you that the "App Paths" feature can have unexpected side effects. Telling from the behaviour of cmd.exe, even Microsoft does not seem to think that taking "App Paths" into consideration is mandatory.

Only Christian Ghisler can tell why he does not make sure to ignore "App Paths" entries. And he is not only the responsible developer, but the only developer.

I just played devil's advocat, because we might as well bash Microsoft for introducing such a stupid feature like "App Paths". But I guess doing so is less likely to have the desired effect than complaining about T.C.

Cheers,
Karl
reflex
Junior Member
Junior Member
Posts: 20
Joined: 2009-01-23, 22:40 UTC

Post by *reflex »

@karlchen: Can you provide some links?

I could not find any relevant info from Microsoft about "app paths" and especially about the described behavior - the only info i could find is, that the app path is appended to the path environment variable, when using api call ShellExecute(), but the path will be evaluated after the current directory...(except in TC)

Devil's advocat? Well, for me your solutions and arguments sounded as you would not take this problem serious - but if you are not involved with TC it is ok.
Post Reply