PC Review


Reply
Thread Tools Rate Thread

can i use compound command in "for" command?

 
 
thinktwice
Guest
Posts: n/a
 
      29th Apr 2008
for /F "tokens=1,2,3* delims=," %%i in (myfile.txt) do ( command1,
command2...)
could i?
 
Reply With Quote
 
 
 
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      29th Apr 2008

"thinktwice" <(E-Mail Removed)> wrote in message
news:f6a8cd45-a611-46e6-9a49-(E-Mail Removed)...
> for /F "tokens=1,2,3* delims=," %%i in (myfile.txt) do ( command1,
> command2...)
> could i?


You probably could but you need to spend a little more of your
time in explaining precisely what you're trying to achieve.


 
Reply With Quote
 
thinktwice
Guest
Posts: n/a
 
      30th Apr 2008
thanks for you quick relay

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?

Pegasus (MVP) $B<LF;!'(B
> "thinktwice" <(E-Mail Removed)> wrote in message
> news:f6a8cd45-a611-46e6-9a49-(E-Mail Removed)...
> > for /F "tokens=1,2,3* delims=," %%i in (myfile.txt) do ( command1,
> > command2...)
> > could i?

>
> You probably could but you need to spend a little more of your
> time in explaining precisely what you're trying to achieve.

 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      30th Apr 2008
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. )

"thinktwice" <(E-Mail Removed)> wrote in message
news:fecfaf60-2df8-4c7f-a5a5-(E-Mail Removed)...
> thanks for you quick relay
>
> 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?
>
> Pegasus (MVP) $B<LF;!'(B
>> "thinktwice" <(E-Mail Removed)> wrote in message
>> news:f6a8cd45-a611-46e6-9a49-(E-Mail Removed)...
>> > for /F "tokens=1,2,3* delims=," %%i in (myfile.txt) do ( command1,
>> > command2...)
>> > could i?

>>
>> You probably could but you need to spend a little more of your
>> time in explaining precisely what you're trying to achieve.



 
Reply With Quote
 
pjp
Guest
Posts: n/a
 
      4th May 2008
Besides the parenthesis someone else posted, you can also call one batch
file from another even passing parameters to it as required.

"thinktwice" <(E-Mail Removed)> wrote in message
news:fecfaf60-2df8-4c7f-a5a5-(E-Mail Removed)...
> thanks for you quick relay
>
> 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?
>
> Pegasus (MVP) $B<LF;!'(B
> > "thinktwice" <(E-Mail Removed)> wrote in message
> >

news:f6a8cd45-a611-46e6-9a49-(E-Mail Removed)...
> > > for /F "tokens=1,2,3* delims=," %%i in (myfile.txt) do ( command1,
> > > command2...)
> > > could i?

> >
> > You probably could but you need to spend a little more of your
> > time in explaining precisely what you're trying to achieve.



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
after a ftp put command it just says "200 PORT command successful." and hangs forever. What could be wrong? when i test the ftp server using IE in "passive" mode it works fine. but ftp at command line hangs on "200 PORT comma Daniel Microsoft Windows 2000 Security 6 1st May 2006 02:51 PM
after a ftp put command it just says "200 PORT command successful." and hangs forever. What could be wrong? when i test the ftp server using IE in "passive" mode it works fine. but ftp at command line hangs on "200 PORT comma Daniel Microsoft Windows 2000 Networking 1 29th Apr 2006 02:42 AM
after a ftp put command it just says "200 PORT command successful." and hangs forever. What could be wrong? when i test the ftp server using IE in "passive" mode it works fine. but ftp at command line hangs on "200 PORT comma Daniel Microsoft Windows 2000 1 29th Apr 2006 02:05 AM
Disconnect network drive with a "net" command line command / Opposite of "net use" ? Anja Mechtel Windows XP Networking 2 26th Apr 2006 10:22 AM
Disconnect network drive with a "net" command line command / Opposite of "net use" ? Anja Mechtel Windows XP Help 1 26th Apr 2006 09:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:38 PM.