如何从命令行传递新的行符到PowerShell?
// MyScript.ps1:
[CmdletBinding()]
Param(
[Parameter()] $Param
)
Write-Host $Param
// Command line (not PowerShell - cmd.exe!)
powershell.exe -File MyScript.ps1 -Param "First`nSecond"
无效。同时,使用命令行的新行字符\n
也不起作用。那么如何向命令行传递新行?
replace
调用中重复使用反引号,则可以使用(反引号 n)。$x = $param.Replace("``n", "
n")` - Vesper