![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Multiple commands in batch file loop Hi, In a batch file, is it possible to execute more than one command for each iteration of a FOR loop (i.e. more than one command for each file of the set)? Thanks! mrgou |
My System Specs![]() |
| | #2 (permalink) | ||||||||||||
| Guest | Re: Multiple commands in batch file loop Create a secondary batch file that processes each file and call it like this: for %f in (*.txt) do call process.bat %f =process.bat= @Echo Off Command1.exe %1 Command2.exe %1 etc... HTH mrgou wrote:
| ||||||||||||
My System Specs![]() | |||||||||||||
| | #3 (permalink) | ||||||||||||||||||||||||
| Guest | Re: Multiple commands in batch file loop Best to include the PowerShell equivalent: ;-) gci *.txt | % {Command1.exe $_.FullName; Command2.exe $_.FullName} Gordon Bell wrote:
| ||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||
| | #4 (permalink) | ||||||||||||||||||||||||||||||||||||
| Guest | Re: Multiple commands in batch file loop Any relation to the DEC Gordon Bell? -- BobF. "Gordon Bell" <gsbell@xxxxxx> wrote in message news:eAPN%23hUhIHA.5780@xxxxxx
| ||||||||||||||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||||||||||||||
| | #5 (permalink) | ||||||||||||
| Guest | Re: Multiple commands in batch file loop No, I get asked often though. He's at MS Research now. http://research.microsoft.com/users/gbell/ Bob F. wrote:
| ||||||||||||
My System Specs![]() | |||||||||||||
| | #6 (permalink) | ||||||||||||||||||||||||
| Guest | Re: Multiple commands in batch file loop yup...we were business acquaint nesses during his DEC and my Heath Co. days. -- BobF. "Gordon Bell" <gsbell@xxxxxx> wrote in message news:e5lCj0UhIHA.1204@xxxxxx
| ||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||
| | #7 (permalink) | ||||||||||||||||||||||||
| Guest | Re: Multiple commands in batch file loop Hi, this newsgroup is about powershell, not batch, but I'll answer anyway. You don't need to use a separate batchfile, you can do that in the same batch by using ( and ) like this: For %%f in (*.txt) do ( Command1 %1 Command2 %1 ) Greetz, Ben "Gordon Bell" <gsbell@xxxxxx> wrote in message news:eMTEYfUhIHA.5824@xxxxxx
| ||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multiple commands in batch file loop | mrgou | Vista General | 6 | 03-13-2008 04:55 PM |
| Batch file | Bob | Vista General | 1 | 01-20-2008 07:39 AM |
| batch file calling exe file problem | JPS | Vista security | 1 | 12-19-2007 07:18 PM |
| Bug spreading pipeline commands across multiple lines in a script | Keith Hill [MVP] | PowerShell | 8 | 05-03-2007 10:17 PM |
| output format with multiple commands | William Stacey [C# MVP] | PowerShell | 9 | 02-13-2007 11:34 AM |