Escaping quotes and double quotes

后端 未结 3 1473
说谎
说谎 2020-11-29 04:11

How do I properly escape the quotes in the -param value in the following command line?

$cmd=\"\\\\server\\toto.exe -batch=B -param=\"sort1;parmt         


        
3条回答
  •  一个人的身影
    2020-11-29 05:05

    I found myself in a similar predicament today while trying to run a command through a Node.js module:

    I was using the PowerShell and trying to run:

    command -e 'func($a)'
    

    But with the extra symbols, PowerShell was mangling the arguments. To fix, I back-tick escaped double-quote marks:

    command -e `"func($a)`"
    

提交回复
热议问题