(solved) MultiRenameTool: I need a guide to""[%x%] Insert value of env var""

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
Stefan2
Power Member
Power Member
Posts: 4153
Joined: 2007-09-13, 22:20 UTC
Location: Europa

(solved) MultiRenameTool: I need a guide to""[%x%] Insert value of env var""

Post by *Stefan2 »

Question:

How should that work in MRT?
- [%x%] Insert value of environment variable "x".


I tested this, but it inserts plain text only into the preview:
[%date%]
[%User%]
[%USER%]
[%COMMANDER_PATH%]



TC 10.00
TC 10.50b5
Windows [Version 10.0.19044.1706]



 
User avatar
Ovg
Power Member
Power Member
Posts: 756
Joined: 2014-01-06, 16:26 UTC

Re: MultiRenameTool: guide to""[%x%] Insert value of env var""

Post by *Ovg »

2Stefan2

Hmm

%date% doesn't work for me too
I haven't environment variable user, but %username% working fine
Other environment variables (that exist in output of set command) working fine for me
TC 10.50b5 x64 / Win 10.0.17763.2928
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
User avatar
Stefan2
Power Member
Power Member
Posts: 4153
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: MultiRenameTool: I need a guide to""[%x%] Insert value of env var""

Post by *Stefan2 »

Yeah, thank, I tried rather with commands than vars, .... if I do it now right, it works

Please forget it, I did it wrong.



Works
[%windir%]
[%USERDOMAIN%]
[%USERNAME%]
[%COMMANDER_PATH%] works now too


Do not
[%hostname%]
[%User%]
[%date%]




 
User avatar
Dalai
Power Member
Power Member
Posts: 9386
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: MultiRenameTool: guide to""[%x%] Insert value of env var""

Post by *Dalai »

%date% is not an environment variable, it's a dynamic variable in CMD only. The same applies to %time%, %cd%, %random%, %errorlevel% and some others; see set /? on a CMD, and ss64.com.

For me, [%UserName%] works fine, and also [%COMMANDER_PATH%] is shown correctly in the preview. The former also renames properly, I haven't tested the latter.

%User% doesn't exist by default, only %UserName% does. The latter is also listed in the menu after clicking the [+] button next to the [N] Name button.

What doesn't work for me is using such environment variables in F7 and Shift+F4 dialogs, although the history claims that it works:

Code: Select all

22.09.17 Added: Support environment variables in multi-rename tool, F7 and Shift+F4: [%USERNAME%] or [%USERNAME%1-5] (32/64)
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
Stefan2
Power Member
Power Member
Posts: 4153
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: MultiRenameTool: I need a guide to""[%x%] Insert value of env var""

Post by *Stefan2 »

You are right, thanks.

Me guess I was thinking about "echo %date%" and just tried %date% as like a env var, silly me.



 
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48075
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: (solved) MultiRenameTool: I need a guide to""[%x%] Insert value of env var""

Post by *ghisler(Author) »

To use placeholders like [%USERNAME%] in F7 or Shift+F4, you need to start the name with < (smaller than).
This will be added automatically when adding a placeholder via "+" button.
< is used because it is a reserved character which cannot appear in file names.
Author of Total Commander
https://www.ghisler.com
User avatar
Dalai
Power Member
Power Member
Posts: 9386
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: (solved) MultiRenameTool: I need a guide to""[%x%] Insert value of env var""

Post by *Dalai »

2ghisler(Author)
Got it, thanks. That wasn't clear from the history excerpt I posted.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48075
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: (solved) MultiRenameTool: I need a guide to""[%x%] Insert value of env var""

Post by *ghisler(Author) »

It's necessary because [%USERNAME%] is a valid name for files and folders.
Author of Total Commander
https://www.ghisler.com
Post Reply