Bootloader configuration automation

I’m trying to automate bootloader configuration process,
I want to make a batch file or C program that will automatically will do the following (as example):
press SPACE to enter bootloader menu ,
then will press C to Clear the flash registry.

Is there any proper way to do it?

You could use e.g. winexpect or wexpect as mentioned in the following article on our developer website.

Thanks I’ll give it a try, that looks good to me.