我选择了像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:\Deploy\REG_DEPLOY\POS_regs\Safe_Year\Safe_Year.reg
我想只排除文件名和extestion。
谢谢
答案 0 :(得分:0)
选择:
第一行返回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"