• Editor
  • 关于在windows批量导出问题

Related Discussions
...

你好,
求关于在windows批量导出spine文件到二进制文件的cmd指令,比如在“c:/lili/”里面有很多文件夹,每个文件夹都有spine的文件,想导出到“c:/lili/exp”文件夹里面,如何实现*.spine遍历全部子文件夹导出全部二进制文件
mac批量导出指令也求一个

谢谢

Batch scripting is absolutely terrible for Windows. You can this:

@echo off
for /r %%s in (*.spine) do echo "C:\Program Files (x86)\Spine\Spine.com" -i "%%s" -e export.json

This script will output something like:

"C:\Program Files (x86)\Spine\Spine.com" -i "C:\Dev\spine\spine-launcher\dist\examples\alien\alien-ess.spine" -e export.json
"C:\Program Files (x86)\Spine\Spine.com" -i "C:\Dev\spine\spine-launcher\dist\examples\alien\alien-pro.spine" -e export.json
"C:\Program Files (x86)\Spine\Spine.com" -i "C:\Dev\spine\spine-launcher\dist\examples\coin\coin-pro.spine" -e export.json
"C:\Program Files (x86)\Spine\Spine.com" -i "C:\Dev\spine\spine-launcher\dist\examples\dragon\dragon-ess.spine" -e export.json
"C:\Program Files (x86)\Spine\Spine.com" -i "C:\Dev\spine\spine-launcher\dist\examples\goblins\attachments.spine" -e export.json
"C:\Program Files (x86)\Spine\Spine.com" -i "C:\Dev\spine\spine-launcher\dist\examples\goblins\goblins-ess.spine" -e export.json
"C:\Program Files (x86)\Spine\Spine.com" -i "C:\Dev\spine\spine-launcher\dist\examples\goblins\goblins-pro.spine" -e export.json
"C:\Program Files (x86)\Spine\Spine.com" -i "C:\Dev\spine\spine-launcher\dist\examples\hero\hero-ess.spine" -e export.json
"C:\Program Files (x86)\Spine\Spine.com" -i "C:\Dev\spine\spine-launcher\dist\examples\hero\hero-pro.spine" -e export.json
"C:\Program Files (x86)\Spine\Spine.com" -i "C:\Dev\spine\spine-launcher\dist\examples\powerup\powerup-ess.spine" -e export.json
"C:\Program Files (x86)\Spine\Spine.com" -i "C:\Dev\spine\spine-launcher\dist\examples\powerup\powerup-pro.spine" -e export.json
"C:\Program Files (x86)\Spine\Spine.com" -i "C:\Dev\spine\spine-launcher\dist\examples\raptor\raptor-pro.spine" -e export.json
"C:\Program Files (x86)\Spine\Spine.com" -i "C:\Dev\spine\spine-launcher\dist\examples\speedy\speedy-ess.spine" -e export.json
"C:\Program Files (x86)\Spine\Spine.com" -i "C:\Dev\spine\spine-launcher\dist\examples\spineboy\spineboy-ess.spine" -e export.json
"C:\Program Files (x86)\Spine\Spine.com" -i "C:\Dev\spine\spine-launcher\dist\examples\spineboy\spineboy-pro.spine" -e export.json
"C:\Program Files (x86)\Spine\Spine.com" -i "C:\Dev\spine\spine-launcher\dist\examples\spinosaurus\spinosaurus-ess.spine" -e export.json
"C:\Program Files (x86)\Spine\Spine.com" -i "C:\Dev\spine\spine-launcher\dist\examples\stretchyman\stretchyman-pro.spine" -e export.json
"C:\Program Files (x86)\Spine\Spine.com" -i "C:\Dev\spine\spine-launcher\dist\examples\tank\tank-pro.spine" -e export.json
"C:\Program Files (x86)\Spine\Spine.com" -i "C:\Dev\spine\spine-launcher\dist\examples\vine\vine-pro.spine" -e export.json

You need to provide the export.json file, described here.

These commands aren't great because they run Spine many times. You can specify multiple exports with one run of Spine, eg:

"C:\Program Files (x86)\Spine\Spine.com" -i file1.spine -e export.json -i file2.spine -e export.json

Writing a Windows batch script to build this command is complex. Likely you can generate something close using the above, then hand edit it.

On Mac or Linux it is much better. There are no lack of scripts on the internet on how to collect files and execute commands. FWIW, we use this script to export our example projects:
spine-runtimes/export.sh at 3.6

Thank you very much!