Manage routeros via CMD

Hello! I try to make some shortcut for employe to restars mikrotik AP.
I try to use API for that, but it seems there is no way to use .bat file, or smth. similar. If somebody has achived remote control of ROS without winbox, please tell how?
I know that I can write application on C, or delphi, but I’m sure that there is an more easy way.

There’s not exactly an easier way… In that you do need some sort of a “special” application to then connect to the router in some fashion and do the reboot. There’s nothing built into Windows (if that’s what you mean by “easier”) that would suffice.

You could install something like PuTTY (or should I say “plink”), and create a bat-like file to contain the command, and run that, but this still means installing plink and the file, and wrapping up the call to plink in a bat file that would then call it with the appropriate arguments.


If you make a custom application (with the credentials and command hard coded; If you want to VERY easily make the application; making it configurable would be slightly harder), you could create a single exe, which would be all that’s needed on a remote machine… Which may sound harder to do than the above, except not really… Not for a single purpose and simple application like that.

Maybe this will help you :

http://stackoverflow.com/questions/13197376/is-it-possible-to-use-a-batch-file-to-establish-a-telnet-session-send-a-command

A few ways to to what you want with .bat + .vbs scripts or with a small external utility (i haven’t tested it)

I try both utiliti and vbs script.
But no way - can’t login.
The most common utility is http://support.moonpoint.com/downloads/windows/network/Telnet/tst10.php
But it seems that there is something withencoding in mikrotik telnet terminal, or who knows…
But only Putty can login via telnet - any other client fails.
I’ve attached some example script.
MainHotspotRestart.txt (176 Bytes)

It works. I tested it, but sometimes it can take 1min to finish. Maybe because it tries to draw the output, but it is not visible, also some mistakes in your script, should be :

192.168.22.1 23
WAIT "Login: "
SEND "admin\m"
WAIT "Password: "
SEND "noone\m"
WAIT "> "
SEND "/ip hotspot disable 0\m"
WAIT "> "
SEND "/ip hotspot enable 0\m"

Thank’s a lot.
It seems that I just was to in a hurry to wait more. It really takes some time, but works :slight_smile:

great script