Open multiple command windows and run a seperate command in each window.

Edward Pamias
Edward Pamias used Ask the Experts™
on
I have to open 32 command windows and run a command in each window. Such as

psshutdown @nyp1.txt -s -f -t 0

The name of the text file changes in each windows nyp1.txt   nyp2.txt  thru 32    - I wanted to know if there is a command that I can run that would automate the process by opening  the command windows and run the psshutdown command for me, so I don't have to do it manually?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2018
Distinguished Expert 2018
Commented:
Try it like this:
@echo off
setlocal
for /l %%i in (1, 1, 32) do (
	start "Shutdown nyp%%i.txt" cmd.exe /c psshutdown.exe @nyp%%i.txt -s -f -t 0
)

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial