usercmd.ini Path without backslash as Variable in usercmd.ini

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
blacky
Senior Member
Senior Member
Posts: 311
Joined: 2003-02-07, 16:58 UTC
Location: was das/whot's dath ?

usercmd.ini Path without backslash as Variable in usercmd.ini

Post by *blacky »

Hi,

i whant work with subst, and there need i a Path without last backslash for it's works,

as example,
%P = full Path with backslash
there could stay
%p = path without backslash

Big P with backslash, small p without backslash at end of the full path,
then should also works


subst v: %P (C:\bearbeit\)

subst v: %p (C:\bearbeit)

or exist some variable.. i think, i have found nothing..
also in the Wiki under usercmd.ini stand nothing ..

best
Meine Blackysgate.de/net
Ma' Personal licence : already one. Hab auch eine
Mein Computer : Einer/once ??? bahh, Rz/Data Centre !
Kitchen, Liv.room, TV, Schlafz.. Sch...
BS/OS: Win3.1/7, Fedora a. other, Reactos
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1008
Joined: 2004-07-29, 11:00 UTC

Re: usercmd.ini Path without backslash as Variable in usercmd.ini

Post by *ZoSTeR »

You could use a batch file for this:

Code: Select all

Echo %1%
Set folderpath=%1%
If %folderpath:~-1%==\ Set folderpath=%folderpath:~0,-1%
Echo %folderpath%
Subst v: %folderpath%
Pause
Put it on a button with parameter %P
Remove the echos and pause after testing and set "Run minimized"
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: usercmd.ini Path without backslash as Variable in usercmd.ini

Post by *petermad »

2blacky

%p is alreday used for short path name:
Help wrote:%N and %M insert the long name, while %n and %m insert the DOS alias name (8.3). %P and %T insert the long path name, and %p and %t the short path name (Same for %o, %e, %b and %s). %p/%t inserts the ftp URL of the directory for ftp connections.
You can use: %P:~0,-1 to cut off the backslash:
Help wrote: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.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
blacky
Senior Member
Senior Member
Posts: 311
Joined: 2003-02-07, 16:58 UTC
Location: was das/whot's dath ?

Re: usercmd.ini Path without backslash as Variable in usercmd.ini

Post by *blacky »

suupy, thank you very mutch :)

added the the wiki :
https://www.ghisler.ch/wikide/index.php?title=Usercmd.ini_Einstellungen

and added at example
[em_subst+]
cmd=cmd
param=? /C subst <drive> "%P:~0,-1"
#path= "Startpfad": Arbeitsordner, bleibt meistens leer, da das gerade aktive Panel (Fenster) als Arbeitsverzeichnis verwendet wird.
menu= Add Subst Drive #"Tooltip”: Bezeichnung, eigene Erklärung zu diesem Befehl.
button=shell32.dll,9
iconic=1 # Programmfenster minimiert, -oder- "0": Programmfenster maximiert ausführen

[em_subst-]
cmd=cmd #"Kommando": kompletter oder relativer Pfad zum gewünschten Programm, oder ein internes cm_xxx oder Benutzer Kommando em_xxx.
param=?/C subst /D %P:~0,-1
menu=Remove Subst Drive # "Tooltip”: Bezeichnung, eigene Erklärung zu diesem Befehl.
button=shell32.dll,10
#iconic= "1": Programmfenster minimiert, -oder- "0": Programmfenster maximiert ausführen

[em_subst]
cmd=cmd
param=/C echo. & echo. & echo mounted Subst Drives & echo =============================== & echo. & subst & echo. & echo =============================== & echo Please press anykey .. & pause >NUL
# path= "Startpfad": Arbeitsordner, bleibt meistens leer, da das gerade aktive Panel (Fenster) als Arbeitsverzeichnis verwendet wird.
menu= Show the Subst-drives # "Tooltip”: Bezeichnung, eigene Erklärung zu diesem Befehl.
button=shell32.dll,8
#iconic= "1" # Programmfenster minimiert, -oder- "0": Programmfenster maximiert ausführen
by the way, you are able to copy the german Wiki entry to wikien so also in different languages..
Meine Blackysgate.de/net
Ma' Personal licence : already one. Hab auch eine
Mein Computer : Einer/once ??? bahh, Rz/Data Centre !
Kitchen, Liv.room, TV, Schlafz.. Sch...
BS/OS: Win3.1/7, Fedora a. other, Reactos
Post Reply