且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

“@"是什么意思?符号在PowerShell中做什么?

更新时间:2023-11-08 13:33:04

PowerShell 实际上会将任何以逗号分隔的列表视为数组:

PowerShell will actually treat any comma-separated list as an array:

"server1","server2"

所以@ 在这些情况下是可选的.但是,对于关联数组,@ 是必需的:

So the @ is optional in those cases. However, for associative arrays, the @ is required:

@{"Key"="Value";"Key2"="Value2"}

官方来说,@ 是数组运算符".您可以在随 PowerShell 一起安装的文档中或在我与人合着的Windows PowerShell:TFM"之类的书中阅读有关它的更多信息.

Officially, @ is the "array operator." You can read more about it in the documentation that installed along with PowerShell, or in a book like "Windows PowerShell: TFM," which I co-authored.