I have two scripts. First script is asking user for some input and calling another script giving it the input as a parameter. Second script is again asking user for the same input.
first.bat
set /p input=Insert your input:
call second.bat %input%
second.bat
if %1 == "Y" input=%1 & goto skipInput
set /p input=Insert the same input:
:skipInput
echo Skipped user input
Is it possible to set second user input with first input value without user pressing the same input value? Problem is that set /p in second.bat cannot be skipped like in upper example.
Updated solution:
first.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
I’m not 100% sure what you are trying to do, but maybe this
First.bat
Second.bat
Which will set the variable
inputin the second script to the value ofinputin the first script.Update
If you only have access to the initial batch that calls the others then try this
After running that I managed to get the prompt in the second batch which just has the
set /pline to be filled in using the pipe redirection.