Looping through a hash, or using an array in PowerShell

后端 未结 7 1635
暗喜
暗喜 2020-12-22 21:13

I\'m using this (simplified) chunk of code to extract a set of tables from SQL Server with BCP.

$OutputDirectory = \"c:\\junk\\\"
$ServerOption =   \"-SServe         


        
7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-22 21:32

    You can also do this without a variable

    @{
      'foo' = 222
      'bar' = 333
      'baz' = 444
      'qux' = 555
    } | % getEnumerator | % {
      $_.key
      $_.value
    }
    

提交回复
热议问题