Reputation: 9870
I would like to launch multiple instances of a program called BIOSPwd.exe
.
I use the program by typing the following into CMD
prompt:
BIOSPwd.exe someInputFile.txt anotherInputFile.txt
I would like to do something like the following:
for ($i = 0; $i -lt 4; $i++)
{
BIOSPwd.exe someInputFile$i.txt anotherInputFile$i.txt
}
to run multiple instances of the program with someInputFile1.txt
etc.
However this launches the program from within PowerShell ISE. I'd like it to launch multiple instances of CMD
with that BIOSPwd.exe
program running in each one.
Upvotes: 1
Views: 3137
Reputation: 1716
Something like this?
1..4 | % {
cmd /c "BIOSPwd.exe someInputFile$($_).txt anotherInputFile$($_).txt"
}
Edit: I think the above is running one instance at a time. Try Start-Process
instead:
1..4 | % {
Start-Process -FilePath "cmd" -ArgumentList "/c BIOSPwd.exe someInputFile$($_).txt anotherInputFile$($_).txt"
}
Upvotes: 3