0

Ok, I been struggling with this for days now. I have a little complex script but at the end I just need to set a variable from a Token 4 to the end of the line. Basically I run a command and the output has some words in the beginning that I don't need on my variable. But for resume this is what I want:

set _EVer=Garbage Garbage Garbage This is an example
for /F "tokens=4*" %%G in ('echo "%_EVer%"') do set "_EVerC=%%G

I need that the output that I got "Garbage Garbage This is an example" set a variable "This is an example"

I tried tokens=4* but just sets the first word and nothing else.

Any comments will be welcome :) THANKS

DefToneR
  • 461
  • 5
  • 12
  • `for /F "tokens=3*" %%G in ("%_EVer%") do set "_EVerC=%%H"`, see https://ss64.com/nt/for.html and https://ss64.com/nt/for_f.html – JosefZ Oct 16 '20 at 18:51

1 Answers1

0

as JosefZ comment the solution was:

set _EVer=Garbage Garbage Garbage This is an example
for /F "tokens=3*" %%G in ("%_EVer%") do set "_EVerC=%%H"

The set %%H was the fix. More information https://ss64.com/nt/for.html

"If the clause results in a multiple values then extra parameters are implicitly defined to hold each. These are automatically assigned in alphabetical order %%H %%I %%J ...(implicit parameter definition)"

DefToneR
  • 461
  • 5
  • 12