MikroTik Script to restore backup in scheduler

Hi!
I’m trying to create a script to restore backup. My script is very simple, but it’s not working from scheduler

:local backupfile "MikroTik_2011UiAS_408-20231006-0923.backup" 
/system backup load name=$backupfile

Any suggestions on how to restore backup from *.backup file?

Found solution
Script

:local backupfile "MikroTik_2011UiAS_408-20231006-0923.backup"
/system backup load name=$backupfile password=""
/y

In Scheduler, in On Event: just type script’s name.

/y at the end is wrong and useless.

Not working without it though

Still wrong, becayse "/" before the y is useless, and is still useless inside the scheduler.

"y" only can be used just if the script is tested on terminal.

It's like this and there's nothing you can do about it.

Ok, I have to ask.

Why is a static value assigned to a variable?

I.e., wouldn’t this be the same?

/system backup load name="MikroTik_2011UiAS_408-20231006-0923.backup" password=""

In this case, it is of no use,
otherwise if you have to do multiple operations on the same file
it is simpler to write a script using a variable/constant that represents the name of the file,
without rewriting it entirely each time.

Yep, thanks :slight_smile: , I suspected as much.

In a more sophisticated script it would make sense, but here it doesn’t, if the script is automated and executed periodically one would use a variable for the file name to be able to “compose” it with the date taken from system time, i.e. something like this one:
http://forum.mikrotik.com/t/changing-the-mmm-dd-yyyy-date-format/5183/10

Hi,
This thread helped me a lot. I had to do a backup restore on a remote MT via REST API. I tried various parameters for a long time, but password=“” was simply missing.

Thank You…