passing a very long filename to internal association program

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
tcvol
Junior Member
Junior Member
Posts: 67
Joined: 2009-02-02, 12:35 UTC

passing a very long filename to internal association program

Post by *tcvol »

Hi there,

I have set up various internal command entries for .mp3.
I noticed that there seems to be a problem if the filename and path is longer, e.g. 275.

Is there a setting where I can change this behaviour or is it a limitation?

You can easily reproduce this by setting up: notepad "%1".

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

Post by *MVV »

Are you sure that programs that you're using support long paths?

As for me, Notepad isn't able to open files with long paths so it is not a TC problem. Wordpad seems to be able to open such file via context menu "Open with - Wordpad" but strangely closes when I try to open it via command line. Very same behaviour I see using Windows command line.

Code: Select all

C:\>write F:\Temp\12345678901234567890123456789012345678901234567890123456789012
34567890123456789012345678901234567890\12345678901234567890123456789012345678901
23456789012345678901234567890123456789012345678901234567890\12345678901234567890
12345678901234567890123456789012345678901234567890123456789012345678901234567890
\1.txt

As I see, TC passes correct path to editor. But special handling is required for files with long paths (longer than 259 characters) so only few programs support such paths.
tcvol
Junior Member
Junior Member
Posts: 67
Joined: 2009-02-02, 12:35 UTC

Post by *tcvol »

Hmm ok I didn't think about the program.

Actually it is winamp I have the problem with.
If I drag and drop a file from the long path to winamp it works.

If I use the internal association (winamp /ADD "%1") it does not.
Maybe the problem lies within winamp, I will try to get more information on that.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Try to drop file to WinAmp and open file's information in it, it is interesting if it will show correct path.
umbra
Power Member
Power Member
Posts: 876
Joined: 2012-01-14, 20:41 UTC

Post by *umbra »

2MVV
Explorer automatically passes shortened paths if their long versions are too long. It uses this trick in many occasions - when you double click on some file, drag-n-drop it or create a shortcut to it. If you double clicked on a file from the example in your first post, this would be launched:

Code: Select all

"C:\Windows\system32\NOTEPAD.EXE" F:\Temp\123456~1\123456~1\
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\1.txt
Windows 10 Pro x64, Windows 11 Pro x64
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

That would solve such problem in TC. As I see, Explorer shortens folders until it gets path that fits into 259 character length.
tcvol
Junior Member
Junior Member
Posts: 67
Joined: 2009-02-02, 12:35 UTC

Post by *tcvol »

The tip with the explorer seems not applicable here because how would I know where to trim?

Ok after some tests, it seems that all winamp versions have this problem.

If I check the filename in winamp with right click info I can see the correct long filename with path. It's just that winamp is refusing to play.

BTW drag and drop from TC works fine.
tcvol
Junior Member
Junior Member
Posts: 67
Joined: 2009-02-02, 12:35 UTC

Post by *tcvol »

ok it works now with the short name.
not very beautiful, the cmd window is open for 1 second, but it works now for .mp3 and .m3u.

I used the following internal association:

Code: Select all

"%commander_path%\.scripts\m3u\mp3helper.cmd" "%commander_path%\ess\thx\winamp\winamp.exe" "/ADD" "%1"
and the following helper script to produce a short name:
mp3helper.cmd

Code: Select all

REM creates a short name filename with path of input parameter
for %%a in ("%~3") do "%~1" %~2 "%%~fsa"
thx guys
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

If I check the filename in winamp with right click info I can see the correct long filename with path. It's just that winamp is refusing to play.
That's because names are kept in dynamic strings with unlimited length but if you want to open such file with long name, you must add special prefix to its name (blame Microsoft for such a stupid idea).
not very beautiful, the cmd window is open for 1 second, but it works now for .mp3 and .m3u.
You can create LNK for CMD and set 'minimized' in its properties and then specify LNK instead of CMD in internal associations.
tcvol
Junior Member
Junior Member
Posts: 67
Joined: 2009-02-02, 12:35 UTC

Post by *tcvol »

ok i solved it with hstart.exe (http://www.ntwind.com/software/hstart.html) and the following internal association:

Code: Select all

"%commander_path%\ess\util\cli\hstart.exe" /NOCONSOLE ""%commander_path%\.scripts\m3u\mp3helper.cmd" "%commander_path%\ess\thx\winamp\winamp.exe" "/ADD" "%1""
Post Reply