string - separating variable with a symbol into different parts -
By using batch, I want to be able to separate a variable into two or three parts, for example if I have a string that looks like this: var1; Var2;
How can I be var1 different to be a variable and var2?
In advance thanks
Use this for more "dynamic" method: token = 1,2 Loop creates two variables for
%% i and
%% j & amp; The
string divides into two parts, the delimiter
; :
@echo off and setlocal set "string = var1; var2;" for / f "token = 1,2 daily =;" Set the "variable1 = %% i" in %% i ("% string") and set "variable2 = %% j" echo variable 1:% variable1% echo variable2:% variable2% endlocal pause < / Pre>
@echo off & setlocal enabledelayedexpansion set "string = var1; var2;" Set to %% i (% string%) / set a count = 0 (set / one count + 1 set "variable! Count! Count! = %% i") in echo% count% variables / l %% i (% 1,% count%) (variable %% i:! Variable %% i!) Indoclock
Comments
Post a Comment