PowerShell和cmd.exe命令语法有什么区别? [英] What is the difference between PowerShell and cmd.exe command syntax?
本文介绍了PowerShell和cmd.exe命令语法有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在PowerShell中运行以下命令:
I am running the following command in PowerShell:
PS C:\Users\adminaccount> winrm s winrm/config/service @{AllowUnencrypted="true";
MaxConcurrentOperationsPerUser="4294967295"}
Error: Invalid use of command line. Type "winrm -?" for help.
如您所见,这给了我一个错误。但是cmd.exe中的相同命令可以正常工作:
Which gives me an error, as you could see. But the same command in cmd.exe works fine:
C:\Users\adminaccount>winrm s winrm/config/service @{AllowUnencrypted="true";
MaxConcurrentOperationsPerUser="4294967295"}
Service
...
那么,我应该对PowerShell语法有什么了解才能使它在那里工作?
So, what should I know about PowerShell syntax to get this working there?
推荐答案
@ {}
在PowerShell中定义了哈希表,但是 winrm
需要一个字符串参数。如果要直接在PowerShell中运行命令,请将该引号引起来:
@{}
defines a hashtable in PowerShell, but winrm
expects a string argument. Put that argument in quotes if you want to run the command directly in PowerShell:
winrm s winrm/config/service '@{AllowUnencrypted="true"; MaxConcurrentOperationsPerUser="4294967295"}'
此外,您需要管理员权限才能工作。
Also, you need admin privileges for this to work.
这篇关于PowerShell和cmd.exe命令语法有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文