【问题标题】:Passing output from one command at end of another在另一个命令的末尾传递一个命令的输出
【发布时间】:2019-06-23 17:03:58
【问题描述】:

需要将 txt 文件名传递给另一个命令。我有文件夹,可以将其命名为文件夹并具有 fileXX.txt(末尾的数字正在更改)。如何创建批处理文件来扫描文件夹 *.txt 并将其传递给另一个命令,例如打印。所以最后命令看起来像“print file66.txt”

【问题讨论】:

  • for %%F in ("c:\pathto\folder\file*.txt") do print "%%~fF"
  • 尝试运行它,得到 ---> %%F 在这个时候是出乎意料的。
  • 这是批处理文件语法。要直接从命令行使用它,请将每个 %% 替换为单个 %。 (很高兴看到 print 使用通配符 - 这样更容易)

标签: windows file cmd command pass-through


【解决方案1】:

好的,我用命令自己搞定了,谢谢斯蒂芬的帮助,对不起别人的时间

如果存在 *.txt 打印 *.txt

【讨论】:

    猜你喜欢
    • 2013-11-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-01
    • 1970-01-01
    • 2016-01-30
    • 1970-01-01
    相关资源
    最近更新 更多