我选择了像这样的带有powershell (GUI)的文件
for %%I in (powershell.exe) do if "%%~$PATH:I" neq "" (
set chooser_file=powershell "Add-Type -AssemblyName System.windows.forms|Out-Null;$f=New-Object System.Windows.Forms.OpenFileDialog;$f.InitialDirectory='';$f.Filter='Positive Registry Files (*.reg)||All Files (*.*)|*.*';$f.showHelp=$true;$f.ShowDialog()|Out-Null;$f.FileName"
)
for /f "delims=" %%I in ('%chooser_file%') do set "regfile=%%I"
现在,这个集合给出了文件名为
的完整文件路径C:DeployREG_DEPLOYPOS_regsSafe_YearSafe_Year.reg
我只想排除文件名和扩展名。
谢谢
随你挑:
第一行返回filename.ext
第二行返回drive:path
for /f "delims=" %%I in ('%chooser_file%') do set "regfile=%%~nxI"
for /f "delims=" %%I in ('%chooser_file%') do set "regfile=%%~dpI"