共用方式為


Enable-ExperimentalFeature

在啟動新的PowerShell實例時啟用實驗性功能。

語法

Default (預設值)

Enable-ExperimentalFeature
    [-Name] <String[]>
    [-Scope <ConfigScope>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

Enable-ExperimentalFeature Cmdlet 會透過將具名的實驗性功能新增至 PowerShell 啟動時讀取的 powershell.config.json 設定檔來啟用實驗性功能。

此 Cmdlet 已在 PowerShell 6.2 中引進。

備註

實驗性功能狀態的任何變更只會在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
別名:cf

參數集

(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

Get-ExperimentalFeature Cmdlet 中傳送 ExperimentalFeature 的實例,以啟用。

輸出

None

此 Cmdlet 不會傳回任何輸出。

備註

實驗性功能狀態的變更只會在PowerShell重新啟動時生效。