最近我試圖從javascript中使用mshta獲得一個快速警報框,但我注意到一些奇怪的東西,而且我沒有ideea是什麼問題。這一點,在某種程度上,我一直在努力實現:未終止的字符串常量-mshta:javascript
mshta javascript:alert("The file was stored here:\"C:\\folder_with_space_ _.txt");
它給人的錯誤是一個在這篇文章的標題(炭57)。我試過的東西組合:
//code that works:
mshta javascript:alert("The file was stored here:\"sdadasd");
mshta javascript:alert("The file was stored here:\"\" sdadasd");
//error-notice the space;error on char 35
mshta javascript:alert("The file was stored here:\" sdasds");
它看起來像它給錯誤時,雙引號數量爲奇數,但:
//error
mshta javascript:alert("The file was stored here:\" \"sdadasd");
我試圖做同樣的在瀏覽器的控制檯和它的工作。我相信是某種解析器 - 錯誤。我該如何解決它?(我正在考慮使用fromCharCode直接插入雙引號)。
注意:命令從cmd運行。
命令行中的反斜槓並不像JS中的轉義字符。在字符串中使用單引號。 – Teemu