1.

Solve : Getting %2 %3 %4... in one variable (Batchfile)?

Answer»

Hello...
I am working on a little tool for which I need the user Input.
It should work like:

batchname ATTRIBUT what the user types...

I want get the value of %2 %3 %4 .... in one variable.
Problem is I don't know how many values I have.
Is there a "trick" to get it in one variable?

thanks in advance for any help
uli

There are no tricks. Use the shift command inside a loop.

Something like this:

CODE: [SELECT]:TAG
if .%1==. goto getout
set var=%var% %1
shift
goto tag
:getout
echo %var%

You will end up with a concatenated string. I'll leave it you to eliminate the leading space.

Good luck. 8-)Many thanks Sidewinder.

I played around a little bit and found out that this will bring all item from %1... in the variable input:
set input=%*
set input=%input:~5%

This does the job. %1 can only have 3 characters in this case. 8-)

But I will keep the shift solution in mind.

uli



Discussion

No Comment Found