Testing this command, error when using %P

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
xxxdo1
Junior Member
Junior Member
Posts: 87
Joined: 2024-11-03, 02:45 UTC

Testing this command, error when using %P

Post by *xxxdo1 »

This command copies the selected files to the target panel folder. it can be run.
cmd=%COMSPEC% /c
param=for %%i in (%P%S) do xcopy %%i "%Tbackup_%|$DATE:Y-M-D_h·m·s|\" /s /e /h /y

Replace %T with %P, it will fail
cmd=%COMSPEC% /c
param=for %%i in (%P%S) do xcopy %%i "%Pbackup_%|$DATE:Y-M-D_h·m·s|\" /s /e /h /y
Fla$her
Power Member
Power Member
Posts: 2982
Joined: 2020-01-18, 04:03 UTC

Re: Testing this command, error when using %P

Post by *Fla$her »

The choice of section is unclear. The /e and /s options are not needed for selected files.

Code: Select all

TOTALCMD#BAR#DATA
%comspec% /q/c for %f in
("%S") do xcopy/chkqry %%f "%Pbackup_%|$DATE:Y-M-D_h·m·s|\"
wcmicon2.dll,62
Copy selected files to backup_Y-M-D_h·m·s\

1
But it's better this way:

Code: Select all

TOTALCMD#BAR#DATA
cm_Copy /BGO5PST="backup_%$DATE:Y-M-D_h·m·s%\"

wcmicon2.dll,62
Copy selected files to backup_Y-M-D_h·m·s\
Overquoting is evil! 👎
User avatar
xxxdo1
Junior Member
Junior Member
Posts: 87
Joined: 2024-11-03, 02:45 UTC

Re: Testing this command, error when using %P

Post by *xxxdo1 »

2Fla$her
Thanks, your method is better. I've learned a lot.

I have a question, why can't "for %f in" be put in param?
Fla$her
Power Member
Power Member
Posts: 2982
Joined: 2020-01-18, 04:03 UTC

Re: Testing this command, error when using %P

Post by *Fla$her »

2xxxdo1
You're welcome.

This is done to get more text into the command, as %S can take up a lot of space.
Overquoting is evil! 👎
User avatar
xxxdo1
Junior Member
Junior Member
Posts: 87
Joined: 2024-11-03, 02:45 UTC

Re: Testing this command, error when using %P

Post by *xxxdo1 »

2Fla$her
Why I put "for %f in" into param, it will fail,
Fla$her
Power Member
Power Member
Posts: 2982
Joined: 2020-01-18, 04:03 UTC

Re: Testing this command, error when using %P

Post by *Fla$her »

%%f
Overquoting is evil! 👎
User avatar
xxxdo1
Junior Member
Junior Member
Posts: 87
Joined: 2024-11-03, 02:45 UTC

Re: Testing this command, error when using %P

Post by *xxxdo1 »

2Fla$her
Oh, I am blind. :shock:
Post Reply