【问题标题】:Prevent $ArrayList.Add from outputting new index to host?防止 $ArrayList.Add 向主机输出新索引?
【发布时间】:2013-10-28 09:56:11
【问题描述】:

在 PowerShell 中,如何防止 [System.Collections.ArrayList]$ArrayList=@() ; $ArrayList.Add("New thing") 将新索引的值发送到主机?

谢谢!

【问题讨论】:

    标签: arrays powershell arraylist indexing output


    【解决方案1】:

    您可以将结果转换为 [void],或重定向到 null

    [void]$ArrayList.Add("New thing")
    $ArrayList.Add("New thing") > $nul
    $ArrayList.Add("New thing") | out-null
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-04-27
      • 2017-01-07
      • 2021-12-17
      • 2017-08-18
      • 1970-01-01
      • 2021-01-17
      • 2017-10-11
      • 1970-01-01
      相关资源
      最近更新 更多