[英]How do I pass a quoted string as an argument to an executable in powershell?
我可以像這樣啟動我的應用程序:
electron ./app/main.prod.js --input `SVGSVG`
但是,像這樣開始:
electron ./app/main.prod.js --input '<SVG></SVG>'
導致錯誤: < was unexpected at this time.
這讓我感到驚訝,因為我將特殊字符作為字符串的一部分傳遞。
為什么會出現這個問題?
當 PS 最終將 arguments 傳遞給程序時,這些引號將不再存在。 你可以試試這個電話:
Start-Process electron -ArgumentList "./app/main.prod.js --input `"<SVG></SVG>`""
堅持您的直接調用,這也將起作用:
electron ./app/main.prod.js --input `"<SVG></SVG>`"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.