Answer interactive prompt from within script

Hello, is there any chance to answer an interactive prompt from within a script?

[user@mikrotik] > ip ssh import-host-key private-key-file=flash/id_rsa_mikrotik
This will replace current SSH host key, yes? [y/N]:

[user@mikrotik] > system reset-configuration  
Dangerous! Reset anyway? [y/N]:

Best regards

Hello DerSchlumpf,
I was looking for an answer on your question too.
The solution is straightforward. Just add a

y

on a new line to your script.


/system script
add dont-require-permissions=no name=reset-to-base-config owner=admin policy=reboot,write,policy source="/system reset-configuration keep-users=yes no-defaults=yes skip-backup=yes run-after-reset=flash/base-config.rsc\r\ny"