Windows 7 How to read commands from a text file.

Lubomir

Member
I would like to write some commands into one file and then I want the command line to read the file and do all commands inside the file. Step by step. For example:

C:\Users> project1.exe < text1.txt > data1.txt
C:\Users> project2.exe < text2.txt > data2.txt
C:\Users> project3.exe < text3.txt > data3.txt
Now, I have to write it step by step. I am using Windows 7 Home Premium. I am not a programmer.

Thanks for help.
 
Powershell would be easier
Code:
$projCount = 3

for ($i=1; $i -le $projCount;$i++)
{
    $commands = Get-Content "text$i.txt"
    
    foreach($command in $commands)
    {
        Start-Process "project$i.exe" -ArgumentList $command -RedirectStandardOutput "data$i.txt" -Wait
    }
}
 
Back
Top