バッチファイルの下にパラメーターを記述しそれを読み込んで別のバッチファイルを順番に起動する

バッチファイル

powershell -Command "(Get-Content '%~f0')[2..((Get-Content '%~f0').Length - 1)] | ForEach-Object {Start-Process 'C:\a.bat' -ArgumentList $_ -Wait}"
timeout /t 5&goto:eof
 arg1
 arg2

呼び出されるバッチファイルの例

@echo off
echo 引数: %1
timeout /t 5

bat,PowerShell ,windows

Posted by eightban