バッチファイル内でバッチファイルを呼び出すときの注意事項
スポンサーリンク
Windows、バッチファイルからバッチファイルを呼び出す方法あれこれ|マコトのおもちゃ箱 ~ぼへぼへ自営業者の技術メモ~
↑こちらのエントリの通りなのですがバッチファイル内でバッチファイルを呼び出すときのルールは以下のとおり
サンプルファイル
C:\children1.bat
echo this is children1.bat >> C:\result.log
C:\children2.bat
ping -n 10 localhost echo this is children2.bat >> C:\result.log
C:\children3.bat
echo this is children3.bat >> C:\result.log
連続処理(同期)を行いたい場合
C:\parent.bat
call C:\children1.bat call C:\children2.bat call C:\children3.bat
C:\result.log
this is children1.bat this is children2.bat this is children3.bat
非同期で行いたい場合
C:\parent.bat
start C:\children1.bat start C:\children2.bat start C:\children3.bat
C:\result.log
this is children1.bat this is children3.bat this is children2.bat
ダメな例
C:\parent.bat
C:\children1.bat C:\children2.bat C:\children3.bat
C:\result.log
this is children1.bat