【发布时间】:2018-02-12 20:12:08
【问题描述】:
我的问题是,我想使用我拥有的 .exe 批量转换这些纹理,它不支持批量拖放,但我设法在 this thread here on the site 的帮助下创建了一个 .bat 并进行了修改:
:LOOP
rem check first argument whether it is empty and quit loop in case;
rem `%1` is the argument as is; `%~1` removes surrounding quotes;
rem `"%~1"` therefore ensures that the argument is always enclosed within quotes:
if "%~1"=="" goto :END
rem the argument is passed over to the command to execute (`"%~1"`):
"E:\project\export\gtf\GTFS\0000gtf2dds.exe" "%~1"
rem `shift` makes the second argument (`%2`) to be the first (`%1`), the third (`%3`) to be the second (`%2`),...:
shift
rem go back to top:
goto :LOOP
:END
它在少于 100 个文件的情况下可以创造奇迹,但我有 22.000 个文件,当我将它们全部拖动时,它返回一个文件名或扩展名太长错误,我用 Google 搜索,似乎 Windows 无法处理大量行,例如:
"E:\project\export\gtf\GTFS\0000gtf2dds.exe" "tex.gtf" "tex.gtf"
"tex.gtf" "tex.gtf" "tex.gtf" "tex.gtf" "tex.gtf" "tex.gtf" "tex.gtf"
"tex.gtf" "tex.gtf" "tex.gtf" "tex.gtf" "tex.gtf" "tex.gtf" "tex.gtf"
"tex.gtf" "tex.gtf" +20.000 files
所以我需要帮助来弄清楚如何优化它或绕过它以同时拖动文件夹或所有 22k 文件。我是编码和批处理的新手,所以请放轻松:)。
【问题讨论】:
-
查看
For命令的帮助信息:For /? -
它不适用于许多文件。因为所有参数的长度有2048个字符的限制
-
请拨打tour,阅读How to Ask和minimal reproducible example。您在 MCVE 点上发布的内容还可以,但它是您从某个地方复制的一些代码,您并没有付出太多努力来弄清楚如何自己解决这个问题。我们不是编码服务。
-
感谢 Compo!
For命令是我需要的!和先生。很明显(jwdonahue),我在询问之前阅读过,是的,我正在努力解决我的问题。 @edit:我解决了顺便说一句。 -
@MasterZeroFX,然后发布并标记答案。
标签: windows batch-file drag-and-drop