Solved batch - for to set the letters of a word-

October 21, 2011 at 02:46:24
Specs: Windows Vista home premium sp 2
hey guys. i am wondering if it is possible to make a for loop read a file which inside has eg
test or t,e,s,t
how would i make it so that it sets each letter to a different variable
thanks in advance

See More: batch - for to set the letters of a word-

Report •

October 21, 2011 at 16:43:32
hello can anyone help this is what i have so far that dosnt work

set Num=1
for /f "tokens=1,2,3,4,5,6,7,8,9,10 delims=," %%A IN (backupscripts.mattzz) do (
set list!Num!=%%!Num!
set /a Num
echo %list1%>test.test
echo %list2%>>test.test
echo %list3%>>test.test
echo %list4%>>test.test

i cant think of how to get it to work please help

Report •

October 22, 2011 at 01:15:37
✔ Best Answer
In this script the input file contains t,e,s,t

@echo off

for /f "tokens=1-4 delims=," %%A in (backupscripts.mattzz) do (
set list1=%%A&set list2=%%B&set list3=%%C&set list4=%%D

echo %list1%
echo %list2%
echo %list3%
echo %list4%

type test.test

Please come back & tell us if your problem is resolved.

Report •

October 22, 2011 at 23:10:44
nice mate works perfectly
i had to make a few changes and i know i made them in a way that could be made much smaller (the l before number means letter)
the edits so far are below also can you message back if there is a simpler way

for /f "tokens=1-26 delims=," %%A in (%temp%\temp.dat) do (
set l1=%%A&set l2=%%B&set l3=%%C&set l4=%%D&set l5=%%E&set l6=%%F&set l7=%%G&set l8=%%H&set l9=%%I&set l10=%%J&set l11=%%K&set l12=%%L&set l13=%%M&set l14=%%N&set l15=%%O&set l16=%%P&set l17=%%Q&set l18=%%R&set l19=%%S&set l20=%%T&set l21=%%U&set l22=%%V&set l23=%%W&set l24=%%X&set l25=%%Y&set l26=%%Z
echo %l1%%l2%%l3%%l4%%l5%%l6%%l7%%l8%%l9%%l10%%l11%%l12%%l13%%l14%%l15%%l16%%l17%%l18%%l19%%l20%%l21%%l22%%l23%%l24%%l25%%l26%

Report •

Related Solutions

Ask Question