Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
File "testfile" contains only one row with the name of another file "testfile2".
I want to put the name of "testfile2" (example 200308190000) into a variable.
How to write a BAT file that reads "testfile" and put the name of "testfile2" into a variable that I can use ? For example to copy "testfile2" to another directory.

I don't know, but there are plenty of examples on the net, you should search for it. The FIND command will search for a text string in a file:
find "string" [path:filename]
Then you can use SET to assign a variable, refered to like:
set var=3
echo %var%And you can also use CALL to read the commands from another batch file, but I don't know if it works with a text file:
call [path:filename]
That's just a few suggestions, you can find much more at various sites.

![]() |
Epson Equity LT
|
combining files DOS
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |