How to convert argument list to skip first argument?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
PiotrMPPL
Junior Member
Junior Member
Posts: 60
Joined: 2018-10-26, 07:04 UTC

How to convert argument list to skip first argument?

Post by *PiotrMPPL »

How to convert argument list to skip first argument?

Button param "%T" "%S"

%* = "C:\7-Zip Test" "File&Test 1.txt" "File&Test 2.txt" "File&Test 3.txt"

After conversion, this should be the argument list

%filelist% = "File&Test 1.txt" "File&Test 2.txt" "File&Test 3.txt"


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

Re: How to convert argument list to skip first argument?

Post by *Dalai »

I'm assuming you're talking about CMD/batch parameters. %* always returns all parameters that were passed to the script/goto target. That doesn't change if parameters are shifted with

Code: Select all

shift /1
Instead parameters %2 and following need to be used. You can do it like this:

Code: Select all

set "filelist=%2 %3 %4 %5 %6 %7 %8 %9"
Note the correct quotation: beginning it before the variable name and ending it at the end of the line ensures that parameters that contain brackets/parentheses don't screw things up - all while not adding any quotes to the filelist variable. These quotes can be left out if each individual parameter is quoted correctly. All of this assumes that there are not more than 9 parameters in total - which %* would provide but %10 doesn't exist.

HTH

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
Fla$her
Power Member
Power Member
Posts: 2998
Joined: 2020-01-18, 04:03 UTC

Re: How to convert argument list to skip first argument?

Post by *Fla$her »

2PiotrMPPL
And why did you need to create a variable with a string list of names, given the length limit?
Can you make a full-fledged request of what should happen when the button is pressed?
Overquoting is evil! 👎
Post Reply