%$DATE% only resolved in command field

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

%$DATE% only resolved in command field

Post by *Horst.Epp »

The new date variable %$DATE% is only resolved in the command field of a button.
This makes it useless for most purposes.
It should be resolved as parameters.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: %$DATE% only resolved in command field

Post by *Fla$her »

On TC11b3 x32 doesn't work.
Command: %ComSpec% /k echo %$DATE%
Parameters: ?%|$DATE:Y-M-D h.m.s|

Returns: %$DATE% %$DATE:Y-M-D h.m.s%
Overquoting is evil! 👎
User avatar
Gral
Power Member
Power Member
Posts: 1460
Joined: 2005-01-26, 15:12 UTC

Re: %$DATE% only resolved in command field

Post by *Gral »

Strange - fully works here on both x32 and x64 versions on Windows 10
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: %$DATE% only resolved in command field

Post by *Fla$her »

And on XP and 7 how?
Overquoting is evil! 👎
User avatar
solid
Power Member
Power Member
Posts: 747
Joined: 2004-08-09, 11:20 UTC

Re: %$DATE% only resolved in command field

Post by *solid »

I can confirm that it works at my place as well, with both TC versions running on Win10 x64.

Support for the suggestion.
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: %$DATE% only resolved in command field

Post by *petermad »

Fla$her wrote:On TC11b3 x32 doesn't work.
Command: %ComSpec% /k echo %$DATE%
Parameters: ?%|$DATE:Y-M-D h.m.s|
Fla$her wrote:And on XP and 7 how?
Here, the above works fine on Windows 7 and 10, but NOT on Windows XP

On Windows XP it does not work for neither the Command field nor the Parameters field.
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
Gral
Power Member
Power Member
Posts: 1460
Joined: 2005-01-26, 15:12 UTC

Re: %$DATE% only resolved in command field

Post by *Gral »

Works on Windows 7, on XP i didn't try.
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: %$DATE% only resolved in command field

Post by *Fla$her »

2petermad
Confirm. I tested it on XP first. Probably, the same problems exist on earlier versions.

solid wrote: 2023-05-17, 21:13 UTC Support for the suggestion.
%|var|, which appeared in the first beta, applies to all environment variables. There's nothing to add.
Overquoting is evil! 👎
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: %$DATE% only resolved in command field

Post by *ghisler(Author) »

The function to load the %$pseudovar% variables loads and uses the function SHGetKnownFolderPath, which doesn't exist on Windows XP.
I will check for $DATE before trying to load SHGetKnownFolderPath.
Author of Total Commander
https://www.ghisler.com
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: %$DATE% only resolved in command field

Post by *Fla$her »

ghisler(Author) wrote: 2023-05-18, 06:59 UTC I will check for $DATE before trying to load SHGetKnownFolderPath.
And what will it give?
Overquoting is evil! 👎
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: %$DATE% only resolved in command field

Post by *Horst.Epp »

A very simple test under Windows 11 shows that %$DATE% doesn't work in the parameters of a button.
The button starts a cmd script which echos the parameters.

Using the %$DATE% in the command field after the cmd path it works and delivers a date.
If %$DATE% is in the parameters field it simply gets DATE
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: %$DATE% only resolved in command field

Post by *ghisler(Author) »

It will work also on older Windows versions where SHGetKnownFolderPath doesn't exist, like Windows XP.
A very simple test under Windows 11 shows that %$DATE% doesn't work in the parameters of a button.
The parameters field does not support environment variables normally because it supports paramters like %P%N. This would collide with a variable name %P%. Therefore the syntax is different there:
%|Variable name|
Author of Total Commander
https://www.ghisler.com
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: %$DATE% only resolved in command field

Post by *Fla$her »

It will work also on older Windows versions where SHGetKnownFolderPath doesn't exist, like Windows XP.
Good! Thanks for the explanation.
Overquoting is evil! 👎
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: %$DATE% only resolved in command field

Post by *Horst.Epp »

Ok, now I can use it :D
Here my button to pack all selected files/dirs from the source to the target side.
The archive is named like the source dir followed by the current date time.
Example Dirname_20230518_1845

Code: Select all

TOTALCMD#BAR#DATA
"C:\Program Files\7-Zip\7z.exe"
a %T%B_%|$DATE:YMD_hm| @%UL -aoa -mmt -mx9 -ssw -stl -ssp -y -mx9
C:\Program Files\7-Zip\7zFM.exe
Pack selected


-1
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: %$DATE% only resolved in command field

Post by *Fla$her »

FIxed for XP.
Overquoting is evil! 👎
Post Reply