How to include duplicate values when setting environmental variable SET in dos

Posted by Sachin on Super User See other posts from Super User or by Sachin
Published on 2012-10-19T05:32:49Z Indexed on 2012/10/26 11:05 UTC
Read the original article Hit count: 196

I am trying to get the values from a file which has duplilcates also. But while setting the values in environmental variable SET, it is not considering the duplicate values. I am using below code:

for /f "tokens=1,2 delims=@" %%a in (test.txt) do (
   set size=............%%b
   call set %%size:~-12%%=%%a

)
for /f %%a in ('set .') do >>outfile.txt echo %%a

Format of test.txt:
"C\ab"@12345678
"C\ab\we"@345678905
"C\ad\df"@345678905

© Super User or respective owner

Related posts about command-line

Related posts about environment-variables