简体   繁体   English

运行 powershell 脚本时,“>>”是什么?

[英]What is '>>' when running a powershell script?

I'm trying to run a Move-Mailbox powershell command when I hit enter to run it the prompt changes to >> but nothing else happens.我正在尝试运行 Move-Mailbox powershell 命令,当我按回车键运行它时,提示符更改为 >> 但没有其他任何反应。 All the parameters have been provided so I don't see that being the cause.已提供所有参数,因此我认为这不是原因。 It's almost like it's waiting for input but not prompting for what.这几乎就像它在等待输入但不提示输入什么。

    [PS] C:\>Move-Mailbox -TargetDatabase "W2K3-LA-EXCH\First Storage Group\MailboxStore" -Identity Toddles -Gl
obalCatalog W2K3.e2k3.exch.com" -SourceForestGlobalCatalog W2K3-LA.e2k7.com -NTAccountOU "OU=Users,DC=e2k3,DC
=exch,DC=com" -SourceForestCredential $SourceCredential -TargetForestCredential $TargetCredential
>>

In that case >> is a signal that PowerShell is waiting for you to complete the syntax.在这种情况下,>> 是 PowerShell 正在等待您完成语法的信号。 In a good case, if you did the following in the interactive console:在好的情况下,如果您在交互式控制台中执行了以下操作:

get-process | 

You would then get the >> to let you know that the command is incomplete.然后你会得到 >> 让你知道命令不完整。 If I then did:如果我这样做了:

format-table

And hit enter a couple times, it would then evaluate.并按几次输入,然后它会评估。

In your case, it looks like you've got an unpaired quotation mark that is making PowerShell misinterpret it and think you've still got some stuff to add to make it a complete one-liner.在你的情况下,看起来你有一个不成对的引号,这使得 PowerShell 误解它,并认为你还有一些东西要添加以使其成为一个完整的单行。 Check this parameter, I think you need a starting quote:检查这个参数,我认为你需要一个起始报价:

-GlobalCatalog W2K3.e2k3.exch.com"

It is indicating that the command is not complete.表示命令不完整。 If not deliberate means you have not closed an expression, code block or string.如果不是故意的,则意味着您没有关闭表达式、代码块或字符串。

It means your brackets or quotes are not balanced.这意味着您的括号或引号不平衡。 In your case, you're missing a double quote:在您的情况下,您缺少双引号:

-GlobalCatalog W2K3.e2k3.exch.com"

should be:应该:

-GlobalCatalog "W2K3.e2k3.exch.com"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM