batch get 2 vars from one line in txt file

September 29, 2010 at 16:47:55
Specs: Windows 7, 4gb
Hi! I have a file named file.txt. The file contains unknown number of lines. Each line contains file:password. I would like to use batch file in reading.

example file.txt:
ed.rar:123456
de.rar:654321
aabc.rar:qwerty
asd.rar:asdfgh

I would like to use it in extracting password protected rar files that do not have the same password. The syntax would be unrar e %file% p-%password%.

I just do not know if it is possible to extract two variables in a line for every line in batch. Please help me!


See More: batch get 2 vars from one line in txt file

Report •


#1
September 29, 2010 at 17:21:47
Do you mean that you want to unrar all the files which are named in file.txt or do you want to enter the filename then extract the password from file.txt in order to unrar files one at a time?

Report •

#2
September 29, 2010 at 17:29:18
i want to unrar all files in the file column with their respective passwords in the password column.

thanks but i already made a solution:
@echo off
for /f "tokens=1,2 delims=:" %%a in (file.txt) do unrar e %%a p-%%b


Report •
Related Solutions


Ask Question