Merging hashtables in PowerShell: how?

前端 未结 12 1962
猫巷女王i
猫巷女王i 2021-01-07 18:26

I am trying to merge two hashtables, overwriting key-value pairs in the first if the same key exists in the second.

To do this I wrote this function which first remo

12条回答
  •  感情败类
    2021-01-07 19:18

    The open brace has to be on the same line as ForEach-Object or you have to use the line continuation character (backtick).

    This is the case because the code within { ... } is really the value for the -Process parameter of ForEach-Object cmdlet.

    -Process  
    Specifies the script block that is applied to each incoming object.
    

    This will get you past the current issue at hand.

提交回复
热议问题