here is what i want to do.
//myfile.txt
"project1"=vc2005 //projectname=projecttype
"project2"=vc6
"project3"=csharp
i want to write a batch file to read this file and automatically build
these projects.
for /F "tokens=1,2,3* delims==" %%i in (myfile.txt) do (set
projectname=%%i set projecttype =%%j)
but seems i can't write in the above style. can you tell me how to
write compound command in for loop?
Here is one way of doing it:
1. @echo off
2. setlocal enabledelayedexpansion
3. set Source=d:\temp\test.txt
4.
5. for /F "tokens=2,4 delims==" %%a in ('type "%Source%"') do (
6. set projectname=%%a & set projecttype=%%b
7. echo Project name=!projectname! Project type=!projecttype!
8. )
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.