Send commands to a Batch with user input


I have a Batch that I cannot change , its function is to list some files in a specific directory, and after it lists the files it waits for some command from the user.

I would like to automate this process, but without touching the original batch, that is, send this command that the batch is waiting for via another batch with a loop every 1 minute.

Searching in some forums, I found some people suggesting using the pipe to send the commands, but it doesn't work when the batch waits for the user's input.

I would like to know if anyone has any idea of ​​sending the command at the time the batch waits for input?

Exemplo do batch:    
Arquivos parados em Download    
Não há arquivos parados em Download



Probably this bat has a command similar to this:

set /p comando=Comando:

this waits for something to be typed. If this command was loaded, you can't skip it later. In this case there would have to be a GOTO sending the script to another field but this must be typed inside the bat.


goto Pular
set /p comando=Comando:

in that case the command "set /p command=Command:" would be ignored

there is also a way to send information to bat when running it. but bat would load it as %1 %2 %3… ex:

call teste.bat Fala1 Fala2 Fala3

Test.bat file: (if it fails, remove the "~" sign before the number).

set aa=%~1
set bb=%~2
set cc=%~3
Echo %aa% %bb% %cc%
pause >nul
Scroll to Top