%P without backslash
Moderators: Hacker, petermad, Stefan2, white
%P without backslash
When I call a program using the change button bar feature, I can pass %P as parameter. %P represents the path terminated by a "\". Is there clever solution for removing the backslash?
Currently I have two ideas for a workaround.
1. using ? and do manual editing.
2. writing a proxy program
wolf
Currently I have two ideas for a workaround.
1. using ? and do manual editing.
2. writing a proxy program
wolf
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Try %P. with the dot after it. The dot means "current dir", and most programs will accept it.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: %P without backslash
This thread is a bit old
, but I just ran into the same problem.
By combining cmd-substrings and delayed environment variable expansion, I was able to produce the following native (Windows 10) one-liner:
Command:
Parameters:
This demo button produces a cmd.exe window with the following text:
A bit ugly, but it works.

By combining cmd-substrings and delayed environment variable expansion, I was able to produce the following native (Windows 10) one-liner:
Command:
Code: Select all
cmd /V:ON /K
Code: Select all
"set "ZZZZ=%T" && echo "target=%T" && echo "target_fixed=!ZZZZ:~0,-1!" && echo "source=%P%S""
Code: Select all
"target=c:\Temp\2\"
"target_fixed=c:\Temp\2"
"source=c:\Temp\1"
Re: %P without backslash
2igor3v
Help wrote:Note: All parameters now support substring fields in the form :~start,length, e.g. %N:~2,5 or %N:~-8,5 . To append a number directly after the length value, use another ~ character, e.g. %N:~2,5~2. Negative vaules are measured from the end of the string. Example: %P:~0,-1 cuts off the backslash from the path.
The Start value -0 is special: %N:~-0,20 copies the first 20 characters of the name without extension, %N:~-0,-20 the first 20 characters of the extension without the name.
Re: %P without backslash
Overquoting is evil! 👎