0
我想在C#中使用System.Automation dll运行Exchange cmdlet。在C#powershell运行空间中转义单引号
在http://technet.microsoft.com/en-us/library/dd315325.aspx,他们纷纷表示,对于逃逸单引号,我们基本上都需要与其他单引号
例如其追加,
[PS] C:\Windows\system32>Write-Host 'Live and let le''arn'
Live and let le'arn
然而,当我试图做同样的事情使用我的cmdlet,
New-Mailbox -Name 'user1.''.cn'
新的邮箱实际上是以用户的姓名创建的''。cn。我们希望它是用户的CN 代码来执行此cmdlet如下:。
AutomatedRunspace.Command command = new AutomatedRunspace.Command(cmdlet.Command);
foreach (CmdletParameter param in cmdlet.GetParameters())
{
command.Parameters.Add(param.Name, param.Value);
}
pipeline.Commands.Add(command);
有什么我们能做的正确逃生呢?