File / folder chooser dialog from a Windows batch script

后端 未结 9 717
一生所求
一生所求 2020-11-22 11:58

Typically, asking the user to supply a file name to a batch script is a messy affair, requiring no misspellings, quotes around paths with spaces, and so forth. Unfortunatel

9条回答
  •  无人共我
    2020-11-22 12:51

    This should work from XP upwards and does'nt require an hibrid file, it just runs mshta with a long command line:

    @echo off
    set dialog="about:"
    
    for /f "tokens=* delims=" %%p in ('mshta.exe %dialog%') do set "file=%%p"
    echo selected  file is : "%file%"
    pause
    

提交回复
热议问题