TC fails at calling proper command line for external viewer.

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

Post Reply
avada
Senior Member
Senior Member
Posts: 217
Joined: 2007-10-05, 06:24 UTC

TC fails at calling proper command line for external viewer.

Post by *avada »

Hello!
TC simply can't open some files with an external viewer in specific folders. I see no pattern, but in some folders when there's a space in the file the program gets a broken command line. Also some files with spaces in them can be played, but others don't...

I have this in wincmd ini: (Tried normal full path, or adding a path with TC. but it didn't help)

Code: Select all

flv="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.flv
f4v="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.f4v
mp4="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.mp4
mpeg="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.mpeg
mpg="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.mpg
m4v="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.m4v
mkv="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.mkv
avi="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.avi
mov="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.mov
mpl="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.mpl
m2v="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.m2v
asd="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.asd
asf="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.asf
divx="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.divx
nsv="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.nsv
rm="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.rm
rmvb="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.rmvb
wmv="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.wmv
wma="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.wma
mp3="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.mp3
m4a="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.m4a
flac="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.flac
dts="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.dts
dtshd="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.dtshd
part="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.part
vob="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.vob
m2ts="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.m2ts
ogg="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.ogg
ts="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.ts
tak="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.tak
opus="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.opus
mka="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.mka
wv="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.wv
wav="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.wav
bik="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.bik
m4r="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.m4r
webm="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.webm
mts="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.mts
m2t="%COMMANDER_PATH%\plugins\mplayer\mpv.com" ^.m2t
If I have practically same as a button it works:

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_PATH%\plugins\mplayer\mpv.com
%P%N
%COMMANDER_PATH%\plugins\mplayer\mpv.exe

%COMMANDER_PATH%\plugins\mplayer\

-1

For example these don't play:
"h:\t\video file.mp4"
"e:\videó\hangszer\Swiss Alphorns.mp4"

But these do:
"h:\t\asdf.mp4"
"d:\t\video file.mp4"
"e:\videó\hangszer\Viola D'amore.flv"
"e:\videó\hangszer\video file.flv"


I get something like this:
Image: http://abload.de/img/tc-mpv8wr1b.png

Also I notice that with the button I always get proper filename, while with f3 I sometimes get the crappy 8.3 filenames.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6429
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Post by *Horst.Epp »

A strange way to configure an external viewer.
But an extension entry made witf TC looks as follows:
pdf=""C:\Program Files\SumatraPDF\SumatraPDF.exe" ^.pdf"
So your entries are wrong for me.
avada
Senior Member
Senior Member
Posts: 217
Joined: 2007-10-05, 06:24 UTC

Post by *avada »

Horst.Epp wrote:A strange way to configure an external viewer.
But an extension entry made witf TC looks as follows:
pdf=""C:\Program Files\SumatraPDF\SumatraPDF.exe" ^.pdf"
So your entries are wrong for me.
As I mentioned I made a new entry with TC too for testing. Still didn't work.

Just tried again for a couple formats and I got this:

Code: Select all

avi=C:\totalcmd\plugins\mplayer\mpv.com ^.avi
mp4=C:\totalcmd\plugins\mplayer\mpv.com ^.mp4
wmv=C:\totalcmd\plugins\mplayer\mpv.com ^.wmv
mkv=C:\totalcmd\plugins\mplayer\mpv.com ^.mkv
Didn't change anything. Tried it the way you had it. Also didn't change anything.

Something's bugged with TC.
User avatar
HolgerK
Power Member
Power Member
Posts: 5406
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Post by *HolgerK »

2avada

1) Does it work if you use
C:\totalcmd\plugins\mplayer\mpv.exe
instead of
C:\totalcmd\plugins\mplayer\mpv.com

2) Does ist work if you manually edit the association like
avi=C:\totalcmd\plugins\mplayer\mpv.com "%1" ^.avi

3) Did you disable the short dos name creation for ntfs drives:
NtfsDisable8dot3NameCreation=1

Related: file name containing spaces aren't properly handled

Regards
Holger
avada
Senior Member
Senior Member
Posts: 217
Joined: 2007-10-05, 06:24 UTC

Post by *avada »

HolgerK wrote:2avada

1) Does it work if you use
C:\totalcmd\plugins\mplayer\mpv.exe
instead of
C:\totalcmd\plugins\mplayer\mpv.com

2) Does ist work if you manually edit the association like
avi=C:\totalcmd\plugins\mplayer\mpv.com "%1" ^.avi

3) Did you disable the short dos name creation for ntfs drives:
NtfsDisable8dot3NameCreation=1

Related: file name containing spaces aren't properly handled

Regards
Holger
1) Apparently it does. Apparently a broken command line is only sent to the .com variant (which I used because I wanted the CLI window for information)

2) It also works. Nice workaround!

3) Didn't touch it. But I really hope TC doesn't rely on it for anything, in this day and age.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48005
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

.com programs are 16-bit only, and don't support long file names.
Author of Total Commander
https://www.ghisler.com
User avatar
HolgerK
Power Member
Power Member
Posts: 5406
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Post by *HolgerK »

ghisler(Author) wrote:.com programs are 16-bit only
Not necessary true.
http://stackoverflow.com/questions/2115651/difference-between-com-exe-and-bat wrote:However DOS and Windows eventually went to a model where the file extension in a .COM and .EXE didn't mean anything. The program loader first checks the first two bytes of the file. If it happens to be the string MZ (legend has it this stands for the initials of an early Microsoft employee), it will treat it as an EXE, otherwise it will load it as if it were a COM file. Since MZ doesn't map to a sensible x86 instruction to start a program, they can get away with this. Net effect: In some versions of DOS/Windows, an .EXE can be named with .COM and vice versa. For example, in many versions of DOS/Windows, the famous COMMAND.COM was actually an EXE.
Just try it. Rename a 64 bit notepad.exe to notepad.com. :wink:
I would not suggest to use the .com extension for modern executables, but in fact windows checks the header for "MZ" and uses the program loader strategy instead of simply mapping max 64kB into memory and execute the first instruction of the memory block.

Regards
Holger
avada
Senior Member
Senior Member
Posts: 217
Joined: 2007-10-05, 06:24 UTC

Post by *avada »

ghisler(Author) wrote:.com programs are 16-bit only, and don't support long file names.
Even if it's true TC fails to use the short filenames for a lot of files with spaces in their names. It seems to me that it just passes the filenames without quotes.
Also with HolgerK's workaround the mpv.com program is always called with a working command line, where the filename is always in the long format.
avada
Senior Member
Senior Member
Posts: 217
Joined: 2007-10-05, 06:24 UTC

Post by *avada »

HolgerK wrote: Not necessary true.
http://stackoverflow.com/questions/2115651/difference-between-com-exe-and-bat wrote:However DOS and Windows eventually went to a model where the file extension in a .COM and .EXE didn't mean anything. The program loader first checks the first two bytes of the file. If it happens to be the string MZ (legend has it this stands for the initials of an early Microsoft employee), it will treat it as an EXE, otherwise it will load it as if it were a COM file. Since MZ doesn't map to a sensible x86 instruction to start a program, they can get away with this. Net effect: In some versions of DOS/Windows, an .EXE can be named with .COM and vice versa. For example, in many versions of DOS/Windows, the famous COMMAND.COM was actually an EXE.
Just try it. Rename a 64 bit notepad.exe to notepad.com. :wink:
I would not suggest to use the .com extension for modern executables, but in fact windows checks the header for "MZ" and uses the program loader strategy instead of simply mapping max 64kB into memory and execute the first instruction of the memory block.

Regards
Holger
BTW mpv.com starts with MZ.
joker
Junior Member
Junior Member
Posts: 26
Joined: 2006-04-05, 10:42 UTC

Post by *joker »

avada wrote:
ghisler(Author) wrote:.com programs are 16-bit only, and don't support long file names.
Even if it's true TC fails to use the short filenames for a lot of files with spaces in their names. It seems to me that it just passes the filenames without quotes.
Yes, just quote the parameter for the file name.
avada wrote:Also with HolgerK's workaround the mpv.com program is always called with a working command line, where the filename is always in the long format.
Because he quoted the file name.
Post Reply