我正在尝试制作一个批处理文件或脚本或任何类型的自动化过程,该过程将获取文件的所有名称在特定文件夹中,并以特定方式将其放入文本文件中。我对批处理文件了解的不够多,所以我不知道如何使用批处理文件创建或编辑文件。
示例:files 54.png,512.png,762.png =名为texts.def的新文本文件,其中包含以下内容:
texture 54 { pal 0 { file "highres/textures/54.png" } }
texture 512 { pal 0 { file "highres/textures/512.png" } }
texture 762 { pal 0 { file "highres/textures/762.png" } }
您可以尝试以下批处理脚本:
@echo off
Set "MyFolder=C:\temp\Test\"
Set "OutPutFile=textures.def"
Set "Ext=png"
>"%OutPutFile%" (
@for /f "delims=" %%a in ('Dir /a-d /b "%MyFolder%\*.%Ext%"') do (
echo texture %%~na { pal 0 { file "highres/textures/%%a" } }
)
)
pause
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句