Loading a PowerShell hashtable from a file?

前端 未结 6 1154
粉色の甜心
粉色の甜心 2020-12-11 14:45

I\'ve got a file containing some data in PowerShell Object Notation:

@{ X = \'x\'; Y = \'y\' }

I\'d like to load this into a variable from

6条回答
  •  离开以前
    2020-12-11 15:33

    Starting from PowerShell 5.0 you have

    Import-PowerShellDataFile
    

    Which imports values from a .psd1-file. So the only thing you have to do is rename your file to *.psd1

    Official help is here.

提交回复
热议问题