所以我很擅长批处理,我试图制作一个自动安装程序,以便进行一些需要对jar进行的修改。
它会在我拖动文件时执行,但我不知道怎么告诉它执行文件而没有拖拽它并放弃
所以你知道7za应用程序用于提取,正如我所说,如果我拖放文件我想要forge.zip解压缩并注入minecraft.jar
set_source=%APPDATA%\Roaming\.minecraft\bin\forge.zip
set path="%USERPROFILE%";%path%
move 7za.exe %USERPROFILE%
cd %USERPROFILE%
7za x AppData\Roaming\.minecraft\bin\minecraft.jar -oAppData\Roaming\.minecraft\bin\TempStuff\
7za x %* -oAppData\Roaming\.minecraft\bin\TempStuff\ -y
cd %USERPROFILE%\AppData\Roaming\.minecraft\bin\TempStuff\
rmdir /S /Q META-INF
cd %USERPROFILE%\AppData\Roaming\.minecraft\bin
ren minecraft.jar "minecraft_c.jar"
cd %USERPROFILE%
7za a -r minecraft.jar %USERPROFILE%\AppData\Roaming\.minecraft \bin\TempStuff\* -o%USERPROFILE%\AppData\Roaming\.minecraft\bin
cd %USERPROFILE%\AppData\Roaming\.minecraft\bin
rmdir /S /Q TempStuff
cd %USERPROFILE%
move /y %USERPROFILE%\minecraft.jar %USERPROFILE%\AppData\Roaming\.minecraft\bin
pause
这应该覆盖jar中的核心文件以允许修改后的核心文件。抓住是的我确实看了soemone elses替换代码,但我想我搞砸了某个地方...... :(
溶液
set path="%USERPROFILE%";%path%
move 7za.exe %USERPROFILE%
cd %USERPROFILE%
7za x AppData\Roaming\.minecraft\bin\minecraft.jar -oAppData\Roaming\.minecraft\bin\TempStuff\
7za x "%USERPROFILE%\AppData\Roaming\.minecraft\JarMods\*.zip" -oAppData\Roaming\.minecraft\bin\TempStuff\ -y
cd %USERPROFILE%\AppData\Roaming\.minecraft\bin\TempStuff\
rmdir /S /Q META-INF
cd %USERPROFILE%\AppData\Roaming\.minecraft\bin
ren minecraft.jar "minecraft_c.jar"
cd %USERPROFILE%
7za a -r minecraft.jar %USERPROFILE%\AppData\Roaming\.minecraft\bin\TempStuff\* -o%USERPROFILE%\AppData\Roaming\.minecraft\bin
cd %USERPROFILE%\AppData\Roaming\.minecraft\bin
rmdir /S /Q TempStuff
cd %USERPROFILE%
move /y %USERPROFILE%\minecraft.jar %USERPROFILE%\AppData\Roaming\.minecraft\bin
cd %APPDATA%\Roaming\.minecraft
mkdir mods
move "%USERPROFILE%\<insert ModInstall path here>\OtherMods\" %USERPROFILE%\AppData\Roaming\.minecraft\mods
答案 0 :(得分:1)
作者提出了解决方案,但从那时起就没有回到过SO,因此他的解决方案现在将放在这里:
set path="%USERPROFILE%";%path%
move 7za.exe %USERPROFILE%
cd %USERPROFILE%
7za x AppData\Roaming\.minecraft\bin\minecraft.jar -oAppData\Roaming\.minecraft\bin\TempStuff\
7za x "%USERPROFILE%\AppData\Roaming\.minecraft\JarMods\*.zip" -oAppData\Roaming\.minecraft\bin\TempStuff\ -y
cd %USERPROFILE%\AppData\Roaming\.minecraft\bin\TempStuff\
rmdir /S /Q META-INF
cd %USERPROFILE%\AppData\Roaming\.minecraft\bin
ren minecraft.jar "minecraft_c.jar"
cd %USERPROFILE%
7za a -r minecraft.jar %USERPROFILE%\AppData\Roaming\.minecraft\bin\TempStuff\* -o%USERPROFILE%\AppData\Roaming\.minecraft\bin
cd %USERPROFILE%\AppData\Roaming\.minecraft\bin
rmdir /S /Q TempStuff
cd %USERPROFILE%
move /y %USERPROFILE%\minecraft.jar %USERPROFILE%\AppData\Roaming\.minecraft\bin
cd %APPDATA%\Roaming\.minecraft
mkdir mods
move "%USERPROFILE%\<insert ModInstall path here>\OtherMods\" %USERPROFILE%\AppData\Roaming\.minecraft\mods