Import-PowerShellDataFile
Imports values from a .PSD1 file without invoking its contents
语法
ByPath (默认值)
Import-PowerShellDataFile
[[-Path] <String[]>]
[<CommonParameters>]
ByLiteralPath
Import-PowerShellDataFile
[-LiteralPath <String[]>]
[<CommonParameters>]
说明
The Import-PowerShellDataFile
cmdlet returns a hashtable consisting of the key-value pairs in a
.PSD1 file.
示例
Example 1: Retrieve values from PSD1
$content = Import-PowerShellDataFile .\Configuration.psd1
$content
Name Value
---- -----
key1 value1
key2 value2
This examples retrieves the key-value pairs stored in the hashtable kept inside the Configuration.psd1 file.
参数
-LiteralPath
The path to the file being imported. All characters in the path are treated as literal values. Wildcard characters are not processed.
参数属性
类型: | String[] |
默认值: | None |
支持通配符: | False |
不显示: | False |
别名: | PSPath |
参数集
ByLiteralPath
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-Path
The path to the file being imported. Wildcards are allowed but only the first matching file is imported.
参数属性
类型: | String[] |
默认值: | None |
支持通配符: | True |
不显示: | False |
参数集
ByPath
Position: | 0 |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.