User menu and Percent signs

Discussion of bugs and problems found in Altap Salamander. In your reports, please be as descriptive as possible, and report one incident per report. Do not post crash reports here, send us the generated bug report by email instead, please.
User avatar
mdruiter
Posts: 262
Joined: 22 Feb 2006, 15:33
Location: Amsterdam, The Netherlands
Contact:

User menu and Percent signs

Post by mdruiter »

Executing a user menu command (that uses Execute through shell) on some files did not work. Nothing happened... :(

It turns out this is caused by a filename containing a percent character (%). Salamander just replaces $(FullName) by the filename and puts that in the batch file it executes. But CMD interprets percent characters as special: it needs doubling them (%%) to work.
Can Salamander do just that? :idea:
User avatar
tukanos
Posts: 410
Joined: 21 Dec 2005, 19:14

Re: User menu and Percent signs

Post by tukanos »

mdruiter wrote:Executing a user menu command (that uses Execute through shell) on some files did not work. Nothing happened... :(

It turns out this is caused by a filename containing a percent character (%). Salamander just replaces $(FullName) by the filename and puts that in the batch file it executes. But CMD interprets percent characters as special: it needs doubling them (%%) to work.
Can Salamander do just that? :idea:
It is generally it is a bad idea to have '%' in your filename in windows based environment. I can understand that sometimes there is no other way, but if you can, avoid it.

Next to actually help you :).

I don't have access to the Salamander's code so I can only guess here. What Salamander apparently does is use CALL inside the command prompt to call any batch file - and it consumes the '%' the same way as CMD does so you need to double the double => alias quadruple it!

For more see the picture:
Running a batch file that contains a percentage sign
Running a batch file that contains a percentage sign
how_run_files_with_percentage_sign.jpg (157.89 KiB) Viewed 3738 times
P.S. I have made a obvious mistake in the batch file (SET for the filename contains only one % to show what happens. The reason why you have to use two %% is that one serves as a holder for the second one). The mistake can be fixed, as you already mentioned, doubling the %% inside the batch file.
Post Reply