將 Windows PowerShell 磁碟機從其所在位置移除。

語法

Remove-PSDrive [-LiteralName] <string[]> [-Force] [-PSProvider <string[]>] [-Scope <string>] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]

Remove-PSDrive [-Name] <string[]> [-Force] [-PSProvider <string[]>] [-Scope <string>] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]

描述

Remove-PSDrive Cmdlet 會刪除使用 New-PSDrive 所建立的 Windows PowerShell 磁碟機。

Remove-PSDrive 無法利用其他方法刪除 Windows 磁碟機或對應的網路磁碟機,也無法刪除目前的工作磁碟機。

參數

-Force

允許此 Cmdlet 移除目前的 Windows PowerShell 磁碟機。

必要?

false

位置?

named

預設值

接受管線輸入?

false

接受萬用字元?

false

-LiteralName <string[]>

指定 Windows PowerShell 磁碟機的名稱。

LiteralName 會使用實際輸入的內容做為參數值。任何字元均不被解譯成萬用字元。如果名稱中包含逸出字元,請以單引號 (') 括住字元。單引號會指示 Windows PowerShell 不要將任何字元解譯為逸出序列。

必要?

true

位置?

1

預設值

接受管線輸入?

true (ByPropertyName)

接受萬用字元?

false

-Name <string[]>

指定要移除的 Windows PowerShell 磁碟機的名稱。請勿在磁碟機名稱後輸入冒號 (:)。

必要?

true

位置?

1

預設值

接受管線輸入?

true (ByPropertyName)

接受萬用字元?

false

-PSProvider <string[]>

移除與指定之 Windows PowerShell 提供者有關聯的所有 Windows PowerShell 磁碟機。

必要?

false

位置?

named

預設值

接受管線輸入?

true (ByPropertyName)

接受萬用字元?

false

-Scope <string>

接受用來識別正在從中移除磁碟機之範圍的索引。

必要?

false

位置?

named

預設值

接受管線輸入?

true (ByPropertyName)

接受萬用字元?

false

-Confirm

在執行命令前先提示確認。

必要?

false

位置?

named

預設值

接受管線輸入?

false

接受萬用字元?

false

-WhatIf

說明執行命令時將會發生何種情況,但不會實際執行命令。

必要?

false

位置?

named

預設值

接受管線輸入?

false

接受萬用字元?

false

-UseTransaction

將命令加入現用交易中。此參數只有當交易進行中時才有效。如需詳細資訊,請參閱 about_Transactions。

必要?

false

位置?

named

預設值

接受管線輸入?

false

接受萬用字元?

false

<CommonParameters>

這個 Cmdlet 支援一般參數:-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer 和 -OutVariable。如需詳細資訊,請參閱 about_Commonparameters.

輸入和輸出

輸入型別是可經由管道輸出至 Cmdlet 的物件型別。傳回型別則是 Cmdlet 所傳回的物件型別。

輸入

System.Management.Automation.PSDriveInfo

您可以經由管道將磁碟機物件輸出至 Remove-PSDrive。

輸出

這個 Cmdlet 不會傳回任何輸出。

附註

Remove-PSDrive Cmdlet 設計的用意是要操作任一提供者所公開的資料。若要列出可在工作階段中使用的提供者,請輸入 "Get-PSProvider"。如需詳細資訊,請參閱 about_Providers。

範例 1

C:\PS>remove-psdrive -name smp

描述
-----------
這個命令會移除名為 "smp" 的 Windows PowerShell 磁碟機。






請參閱




目錄