创建可以处理数千个文件拖放的批处理文件

时间:2018-02-12 20:12:08

标签: windows batch-file drag-and-drop

我的问题是,我想使用我拥有的.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当我拖动它们所有它返回一个文件名或扩展名太长错误,我googled似乎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文件。我是编码和批处理的新手,所以请放轻松我吧:)。

1 个答案:

答案 0 :(得分:0)

感谢@Compo,在听完您的建议并与朋友交流想法后,我解决了我的问题,这里是我用来处理案件的命令。

{{1}}

我今天才能回答这个问题,因为旅行。