How to create a new file by Mikrotik routers' scripting [closed]

隐身守侯 提交于 2019-12-13 14:24:44

问题


How to create a new file by script on Mikrotik Routerboard (Router OS 6.30)?


回答1:


UPDATE: This solutions also does not work well. It seems to be impossible to create a file and edit (/file set) it during one script call. I have no idea why, but only working solution is to run special create script two times (first creates a file and second edits it).

This easy task took me long time to solve. There is no official way, only some ugly workarounds. The main idea is create a file using some export operation (or fetch from network operation) and then flush created file.

Another problem is that multiple commands in one script file somehow cannot use created file's identifier. So instead of:

/file print file=newFile; /file set newFile contents=""

you must use:

/file print file=newFile; /file set [find name="newFile"] contents=""

Notice that first command just exports list of all files and second one flushes its content.



来源:https://stackoverflow.com/questions/31610559/how-to-create-a-new-file-by-mikrotik-routers-scripting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!