
js
ノード サーバー コードを実行するファイルがあります。 ( notepad++
using経由NPPExec
)
OK - これでサーバーが起動し、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)
注意:URLとして実行したい。
私の例では次のようになります:
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