[11.03] Folder(name) + [Shift+Enter] = problem...
Moderators: Hacker, petermad, Stefan2, white
[11.03] Folder(name) + [Shift+Enter] = problem...
What to do:
1. Just place any CLI prorgam into folder without spaces WITH "(" and ")", e.g.: D:\WorkDir\TC_WCX_AudioConverter_0992a_Orig(OLD)\faac.exe
2. Then try Shift+Enter on it.
3. Get an error, that "D:\WorkDir\TC_WCX_AudioConverter_0992a_Orig" is not a valid executable...
I still can launch "faac.exe" via regular Enter or type "cmd" to command line and launch my exe from there.
If i add a space or "&" to the folder's name, it helps and I can launch my "faac.exe" via Shift+Enter.
W10 x64, both TC 11.03 32 and 64 bits.
1. Just place any CLI prorgam into folder without spaces WITH "(" and ")", e.g.: D:\WorkDir\TC_WCX_AudioConverter_0992a_Orig(OLD)\faac.exe
2. Then try Shift+Enter on it.
3. Get an error, that "D:\WorkDir\TC_WCX_AudioConverter_0992a_Orig" is not a valid executable...
I still can launch "faac.exe" via regular Enter or type "cmd" to command line and launch my exe from there.
If i add a space or "&" to the folder's name, it helps and I can launch my "faac.exe" via Shift+Enter.
W10 x64, both TC 11.03 32 and 64 bits.
Ukrainian Total Commander Translator. Feedback and discuss.
Re: [11.03] Folder(name) + [Shift+Enter] = problem...
Confirmed.
You can also try it with a batch file containing "@echo test" instead of faac.exe.
The same problem occurs when the folder name contains a ^ character and no spaces or &.
You can also try it with a batch file containing "@echo test" instead of faac.exe.
The same problem occurs when the folder name contains a ^ character and no spaces or &.
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: [11.03] Folder(name) + [Shift+Enter] = problem...
TC adds double quotes when the name contains certain characters like spaces or &. I'm not aware of any problems with braces in names. Is this really a problem? Why?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: [11.03] Folder(name) + [Shift+Enter] = problem...
Why is it not a problem?ghisler(Author) wrote: 2024-03-19, 08:12 UTC I'm not aware of any problems with braces in names. Is this really a problem? Why?
- Create a batch file test.cmd with the command: @echo test
- Put test.cmd in a folder named "(test)" or "test^1"
- Pressing Enter on test.cmd works OK
- Pressing Shift+Enter does not work OK. (It does work if you add a space to the folder name or filename)
Re: [11.03] Folder(name) + [Shift+Enter] = problem...
That is definitely a problem. I can't use my CLI prorgam from there.
The easiest solution is just using double quotes for ANY path names. That can fix any problem. No need to find all problematic characters individually.
P.S.
I also remember my old Win XP with "D&S" folder (renamed from "Documents and Settings" to avoid spaces in the paths) and the same problems there. Unfortunately, I didn't know, that the problem was in TC.
This bug really looks the same now.
The easiest solution is just using double quotes for ANY path names. That can fix any problem. No need to find all problematic characters individually.
P.S.
I also remember my old Win XP with "D&S" folder (renamed from "Documents and Settings" to avoid spaces in the paths) and the same problems there. Unfortunately, I didn't know, that the problem was in TC.
This bug really looks the same now.
Ukrainian Total Commander Translator. Feedback and discuss.
Re: [11.03] Folder(name) + [Shift+Enter] = problem...
The problem is that cmd.exe parses its /c command just like it parses commands typed into its console, or batch file lines, and there are a bunch of special characters in cmd.exe commands syntax, some of them like braces, ^, & are valid in filenames and must be quoted to avoid special processing. I think it would't be a problem to always quote paths when Shift+Enter used.
When one does Shift+Enter on e.g. C:\(test)\test.bat, TC calls noclose.exe:
And noclose.exe then starts cmd.exe:
But cmd.exe in Windows NT removes OUTER quotes from command passed after /C or /K and that causes file path to become unquoted (this causes lots of problems, e.g. when you pass a quoted path to a program and a quoted argument for it) when cmd executes it, you can try executing following command in cmd interactively and it will fail:
So, to avoid this stupid cmd.exe behaviour the command line passed to it should be always quoted, even if it already contains quoted path to a program or batch file:
Since this problem affects noclose.exe and not TOTALCMD.exe, it is possible to replace noclose.exe with one that doesn't have this problem, e.g. with this one.
When one does Shift+Enter on e.g. C:\(test)\test.bat, TC calls noclose.exe:
Code: Select all
C:\TOTALCMD\noclose.exe C:\(test)\test.bat
Code: Select all
cmd.exe /K "C:\(test)\test.bat"
Code: Select all
> C:\(test)\test.bat
Code: Select all
cmd.exe /K ""C:\(test)\test.bat""
Since this problem affects noclose.exe and not TOTALCMD.exe, it is possible to replace noclose.exe with one that doesn't have this problem, e.g. with this one.
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: [11.03] Folder(name) + [Shift+Enter] = problem...
Interesting, I have never heard of that problem. I guess that it would be better to add the extra quotes in noclose.exe than in TC, what do you think?But cmd.exe in Windows NT removes OUTER quotes from command passed after /C or /K and that causes file path to become unquoted
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: [11.03] Folder(name) + [Shift+Enter] = problem...
Yes, that is what MVV's suggested link does.ghisler(Author) wrote: 2024-05-31, 14:53 UTCInteresting, I have never heard of that problem. I guess that it would be better to add the extra quotes in noclose.exe than in TC, what do you think?But cmd.exe in Windows NT removes OUTER quotes from command passed after /C or /K and that causes file path to become unquoted
Of course getting a modified version from TC would be better.
Windows 11 Home, Version 24H2 (OS Build 26100.3915)
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
Re: [11.03] Folder(name) + [Shift+Enter] = problem...
Really?ghisler(Author) wrote: 2024-05-31, 14:53 UTCInteresting, I have never heard of that problem.But cmd.exe in Windows NT removes OUTER quotes from command passed after /C or /K and that causes file path to become unquoted
You never read this?cmd | Microsoft Learn wrote: If you specify /c or /k, the cmd processes, the remainder of <string>, and the quotation marks are preserved only if all of the following conditions are met:If the previous conditions aren't met, <string> is processed by examining the first character to verify whether it's an opening quotation mark. If the first character is an opening quotation mark, it's stripped along with the closing quotation mark. Any text following the closing quotation marks is preserved.
- You don't also use /s.
- You use exactly one set of quotation marks.
- You don't use any special characters within the quotation marks (for example: & < > ( ) @ ^ | ).
- You use one or more white-space characters within the quotation marks.
- The <string> within quotation marks is the name of an executable file.
I tend towards that solution. That way noclose.exe could be substituted by programs that are not similar to cmd and don't behave like cmd.ghisler(Author) wrote: 2024-05-31, 14:53 UTC I guess that it would be better to add the extra quotes in noclose.exe than in TC, what do you think?
This also maintains compatibility. People may already use a custom noclose.exe that already adds extra quotes.
If, on the other hand, you want to fix the issue also for noclose.exe replacements that work the same way as noclose.exe (that is launch cmd /k without adding extra quotes), then changing TC is better.
If it comes to show that people need it the other way around, an option could be added to TC to configure whether TC itself adds extra quotes.
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: [11.03] Folder(name) + [Shift+Enter] = problem...
This should be fixed in Total Commander 11.50 beta 1, please check it!
11.04.24 Fixed: Shift+Enter on program (launch in cmd.exe and keep window open): Put path in double quotes if it contains one of the characters ,;=(&^ so cmd.exe can find it (32/64)
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: [11.03] Folder(name) + [Shift+Enter] = problem...
Confirm fixed. Thanks.
Ukrainian Total Commander Translator. Feedback and discuss.