[英]How can I call a console app requiring a parameter that needs double-quotes from PowerShell script?
How can I construct this call below: 我如何构建此调用如下:
C:> ExecuteFoo "2012-10-21 00:00:00" "2012-10-21 00:00:00"
C:> ExecuteFoo“2012-10-21 00:00:00”“2012-10-21 00:00:00”
from the PowerShell Script below: 从下面的PowerShell脚本:
param(
[string] $ReportStart = (get-date -format "yyyy-MM-dd 00:00;00"),
[string] $ReportEnd = (get-date -format "yyyy-MM-dd 23:59:59")
)
# ............ Some stuff here
$Process = [diagnostics.process]::Start("$cmdline", "$ReportStart, $ReportEnd")
try below code directly 直接尝试下面的代码
& $cmdline $ReportStart $ReportEnd
or if escape needed: 或者如果需要逃脱:
& $cmdline "`"$ReportStart`"" "`"$ReportEnd`""
你只需要使用`"
来逃避引号
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.