返回列表 發帖

【RouterOS】—— Full Screen Editor

Whenever you need write scripts on your RouterOS, you may need to prepare your scripts on Windows programs such as Notepad or other applications which allow to write your own scripts. Once scripts are completed, you need to move them onto your RouterOS terminal windows (/file folder). Whenever you have problems in your scripts, you need to repeat the same process to re-edit your scripts and move them to the RouterOS /file again.

You can get rid of the above process using the following command

1. Create of a script in /file folder (just printing the current contents to a file named myFile)
  1. /file
  2. print file=myFile
複製代碼
2. Empty of the file myFile
  1. /file set myFile.txt contents=""
複製代碼
3. Start to edit the file myFile
  1. /file edit myFile.txt
  2. value-name (just press <Enter> key to continue
複製代碼
4. A full-screen editor giving you to edit the file myFile.txt and press <CTRL>+<o> to save and exit the full-screen editing mode

should the script be saved as *.txt format or *.rsc format??
or it doesn't matter?

TOP

In general I would like to prefer .txt format to .rsc format. I am sorry that I forgot the use of .rsc format.

TOP

本帖最後由 gfx86674 於 2018-2-23 08:04 編輯

感覺就像linux上的vi與nano,但還是在windows用記事本編輯好再上傳覆蓋比較方便。

TOP

请教: 如果我copy 师兄们的scripts 到winbox, 是应该copy在 New Terminal 还是 在 schedule里呢? 我看教程 两种都有人做!?

TOP

本帖最後由 gfx86674 於 2018-2-25 00:01 編輯
请教: 如果我copy 师兄们的scripts 到winbox, 是应该copy在 New Terminal 还是 在 schedule里呢? 我看教 ...
vpn-learner 發表於 2018-2-24 17:23

schedule是排程,是安排時間運作script。
貼在new terminal則是即刻執行script,
但要在您找到的script的
第一行最前面加上{
最後一行最尾端加上 }

這樣貼到new terminal的所有文字才會被當成一個完整的script看待,
若不加上面的括弧,會被當成一行一個script,然後跑出一堆錯誤(貼上去的文字會因錯誤變成紅字)

TOP

回復 6# gfx86674


    明白了,谢谢 gfx86674 师兄!

TOP

返回列表