Enable-ExperimentalFeature
在啟動新 PowerShell 實例時啟用實驗性功能。
語法
Default (預設值)
Enable-ExperimentalFeature
[-Name] <String[]>
[-Scope <ConfigScope>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Enable-ExperimentalFeature該指令長透過在 PowerShell 啟動時讀取的設定檔案中加入已命名的實驗性功能powershell.config.json,從而啟用實驗性功能。
此 Cmdlet 已在 PowerShell 6.2 中引進。
Note
任何對實驗性功能狀態的變更,僅在重新啟動 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 |
| 預設值: | None |
| 支援萬用字元: | False |
| 不要顯示: | False |
| 別名: | 參見 |
參數集
(All)
| Position: | Named |
| 必要: | False |
| 來自管線的值: | False |
| 來自管線按屬性名稱的值: | False |
| 來自剩餘引數的值: | False |
-Name
實驗特徵的名稱或名稱,以啟用。
參數屬性
| 類型: | String[] |
| 預設值: | None |
| 支援萬用字元: | False |
| 不要顯示: | False |
參數集
(All)
| Position: | 0 |
| 必要: | True |
| 來自管線的值: | False |
| 來自管線按屬性名稱的值: | True |
| 來自剩餘引數的值: | False |
-Scope
決定要更新哪一個 powershell.config.json ,是影響所有使用者還是僅限於目前使用者。
參數屬性
| 類型: | ConfigScope |
| 預設值: | CurrentUser |
| 接受的值: | AllUsers, CurrentUser |
| 支援萬用字元: | False |
| 不要顯示: | False |
參數集
(All)
| Position: | Named |
| 必要: | False |
| 來自管線的值: | False |
| 來自管線按屬性名稱的值: | False |
| 來自剩餘引數的值: | False |
-WhatIf
顯示 Cmdlet 執行時會發生什麼事。 指令未執行。
參數屬性
| 類型: | SwitchParameter |
| 預設值: | None |
| 支援萬用字元: | False |
| 不要顯示: | False |
| 別名: | 威斯康辛 |
參數集
(All)
| Position: | Named |
| 必要: | False |
| 來自管線的值: | False |
| 來自管線按屬性名稱的值: | False |
| 來自剩餘引數的值: | False |
CommonParameters
此 cmdlet 支援常見參數:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 如需詳細資訊,請參閱 about_CommonParameters。
輸入
ExperimentalFeature
從 cmdlet 管道 ExperimentalFeature Get-ExperimentalFeature 實例到 enable。
輸出
None
此 Cmdlet 不會傳回任何輸出。
備註
實驗性功能的狀態變更只會在 PowerShell 重新啟動時生效。