【问题标题】:How to open only specific file extensions, e.g. .doc and not .docx?如何仅打开特定的文件扩展名,例如.doc 而不是 .docx?
【发布时间】:2014-11-28 22:19:07
【问题描述】:

我一直在尝试使用仅扩展名为 .doc 的 .bat 脚本打开子目录中的文件。但是,它也会打开 .docx 文件。我曾尝试使用引号和反斜杠,但无济于事。

for /r %%v in (*.doc) do start "" /b "%%~v"

如何只打开*.doc,不打开*.docx

【问题讨论】:

    标签: windows batch-file command command-line-arguments command-prompt


    【解决方案1】:
    for /r %%v in (*.doc) do IF /i "%%~xv"==".doc" start "" /b "%%~v"
    

    问题出现是因为掩码匹配“短名称”“长名称”。

    【讨论】:

      猜你喜欢
      • 2022-01-24
      • 2017-03-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多