
我有一個js
運行節點伺服器程式碼的檔案。 (透過notepad++
使用NPPExec
)
好的 - 現在伺服器已啟動並正在監聽http://localhost:3030
但是,我有一個資源管理器樹的左窗格:
目標 :
- 取目前檔名
- 計算其相對位置
c:\program Files (x86)\nodejs\public folder
- 前置
http://localhost:3030
- 跑步
chrome.exe "http://localhost:3030/" + "/angularjs-book-master/chapter2/amail/index.html"
所以,我想運行這個:
NPP_RUN chrome.exe http://localhost:3030/(current file relative to nodejs
民眾folder)
注意:我想將其作為網址運行。
所以在我的例子中我想要:
NPP_RUN chrome.exe http://localhost:3030/angularjs-book-master/chapter2/amail/index.html
index.html
目前顯示的文件在哪裡。
但問題是我不僅有/angularjs-book-master/chapter2/amail/index.html
我有滿的值 哪個是$(FILE_NAME)
哪個是
file:///C:/Program%20Files%20(x86)/nodejs/public/angularjs-book-master/chapter1/order-form.html
我不需要整個字串。一個能從中削減的解決方案file:///C:/Program%20Files%20(x86)/nodejs/public/
也很好。
另外,斜線應該是向後。
簡而言之:
我有NPP_RUN "chrome.exe" $(FILE_NAME)
但這運行:
chrome.exe file:///C:/Program%20Files%20(x86)/nodejs/public/angularjs-book-master/chapter2/amail/index.html
但我想要僅有的這:(注意斜線)
chrome.exe http://localhost:3030/angularjs-book-master/chapter2/amail/index.html