我從另一個討論中得到一個文件選擇器,我想更改InitialDirectory值。現在是:批量+ Powershell文件選擇器 - InitialDirectory
<# :
...
setlocal
for /f "delims=" %%I in ('powershell -noprofile "iex (${%~f0} | out-string)"')
...
goto :EOF
: #>
Add-Type -AssemblyName System.Windows.Forms
$f = new-object Windows.Forms.OpenFileDialog
$f.InitialDirectory = pwd
$f.Filter = "ucsdb backup (ucsdb.*)|ucsdb.*"
$f.ShowHelp = $false
$f.Multiselect = $false
[void]$f.ShowDialog()
if ($f.Multiselect) { $f.FileNames } else { $f.FileName }
它打開當前目錄,但我想打開一個子文件夾。我如何在InitialDirectory中編寫批處理「%cd%\ UCSM_Files \」?
對不起我的英文不好
(更新討論代碼)我已經修改了 '$ f.InitialDirectory = PWD' 到 '$ f.InitialDirectory =聯接路徑-Path $ PWD -ChildPath UCSM_Files' 但是現在開放的文檔文件夾 – Blank517