How do I use string manipulation on a .txt file with multiple lines -


what i'm aiming assign strings,each different line(from txt file),to each own variable.

example of txt:

1 2 3 

i tried doing assigning type output of txt file on variable command

for /f "delims=" %%i in ('type "textfile.txt"') set testingvariable=%%i 

%testingvariable% being variable,i tried string manipulation this

set newvariable=%testingvariable:~3,1% 

hoping come out 2, results had either 0 on 3 numbers or nothing.

is there simple simple solution this?

(and if possible try explain as can still of beginner)

you want every line seperate variable? need counter:

setlocal enabledelayedexpansion set c=0 /f "delims=" %%i in ('type "textfile.txt"') (   set /a c+=1   set testingvariable[!c!]=%%i ) set testingvariable[ 

... , need delayed expansion

note: emty lines skipped


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -