Enable-ExperimentalFeature
在启动 PowerShell 的新实例时启用实验功能。
语法
Enable-ExperimentalFeature
[-Name] <String[]>
[-Scope <ConfigScope>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
Enable-ExperimentalFeature
cmdlet 通过将指定的实验性功能添加到 PowerShell 启动时读取的 powershell.config.json
设置文件中,从而启用这些实验性功能。
PowerShell 6.2 中引入了此 cmdlet。
注意
对实验性功能状态所做的任何更改仅在重启 PowerShell 时生效
示例
示例 1:启用实验性功能
在此示例中,如果以前禁用了此实验功能,则用户更新 powershell.config.json
文件,以便在重新启动 PowerShell 后启用该功能。 成功后,任何内容都不会输出到管道,并且仅显示警告消息。
Enable-ExperimentalFeature PSImplicitRemotingBatching
WARNING: Enabling and disabling experimental features do not take effect until next start of PowerShell.
参数
-Confirm
在运行 cmdlet 之前,提示你进行确认。
类型: | SwitchParameter |
别名: | cf |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Name
要启用的实验功能的名称或名称。
类型: | String[] |
Position: | 0 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-Scope
确定应更新哪个 powershell.config.json
,以及该更新是否影响所有用户或仅影响当前用户。
类型: | ConfigScope |
接受的值: | AllUsers, CurrentUser |
Position: | Named |
默认值: | CurrentUser |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-WhatIf
显示 cmdlet 运行时会发生什么情况。 cmdlet 未运行。
类型: | SwitchParameter |
别名: | wi |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
输入
通过管道发送获取自 Get-ExperimentalFeature
cmdlet 的待启用 ExperimentalFeature 实例。
输出
None
此 cmdlet 不返回任何输出。
备注
对实验功能状态的更改仅在重启 PowerShell 时生效。