$handler_installationfolderlocalinstall_Click = {
$SelectFolder.ShowDialog() | Out-Null
Write-Host "You selected $SelectFolder $($SelectFolder.SelectedPath)" -ForegroundColor Yellow
$textboxinstallfolderlocal.Text = $SelectFolder.FileName
}
我想在帶有“檔案名”的文本框中顯示檔案夾名稱,但它不起作用。哪個擴展名用于檔案夾?或者我怎樣才能顯示它?

檔案夾的路徑應該在文本框中,就像在帶有檔案的下部文本框中一樣,但因為它是一個檔案夾,所以 .FileName 不起作用。

謝謝你的回答????
uj5u.com熱心網友回復:
歡迎來到論壇。如果您的對話框回傳一個目錄,則 'filename' 不是 directoryinfo 物件的屬性。 https://docs.microsoft.com/en-us/dotnet/api/system.io.directoryinfo?view=net-5.0
如果您想查看哪些值可用,請打開一個新的 shell(用于測驗)并針對目錄運行它:
## This will show you the return type of the object so you can figure this out on your own in the future
(Get-Item SomeDirectory).GetType()
## Then after that, run this:
Get-Item SomeDirectory | Get-Member
...這將向您顯示目錄物件或任何其他物件上可用的所有“屬性”和“方法”(統稱為“成員”)。
我懷疑,對于目錄,您會想要使用以下屬性之一:Name、FullName 或 BaseName。
高!
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/345232.html
標籤:电源外壳
上一篇:洗掉具有特定值的行
