私は2つのスクリプトを持っています。最初のスクリプトは、ユーザーに何らかの入力を求め、別のスクリプトを呼び出して入力をパラメーターとして渡します。2 番目のスクリプトは、ユーザーに同じ入力を求めています。
最初のバット
set /p input=Insert your input:
call second.bat %input%
セカンドバット
if %1 == "Y" input=%1 & goto skipInput
set /p input=Insert the same input:
:skipInput
echo Skipped user input
ユーザーが同じ入力値を押さずに、最初の入力値で 2 番目のユーザー入力を設定することは可能ですか? 問題は、上の例のようset /p
にsecond.batをスキップできないことです。
更新されたソリューション:
最初のバット
set /p input=Insert your input:
echo %input% | (cd path/to/file & second.bat)
echo %input% | (cd path/to/file & second.bat)
pause >nul