Jump to content
Official BF Editor Forums

Bf2_pack_batches For Winrar


Recommended Posts

These are based on Rexman's original scripts but allow separate packing a single map, common, menu or object files without the editor. A combined batch for packing your whole mod is provided. Packs samples files and code-only changes, too. Relies on installed WinRAR in at least the unregistered version. Read the accompanying textfile for details.

have fun !

http://www.schoeldgen.de/bf1942/BF2_pack_batches.zip (approx. 5kB :P )

Update 08-04-08 fixes typo in the readme

Note: Not compatible with BF2142 , but probably can be coded to be.

Link to comment
Share on other sites

Wow.. cool!!! Downloading now.. Do you know if it is possible to customize it to use 7-zip?

Anyways.. gonna use it!! The whole "editor leaving out" stuff is pretty annoying! Definetly gonna use this!

EDIT: Just tried it out.. Works like a charm.. even remembers the ambient.con... as Jim Carrey would say: B E A Utiful!

Thanks a lot ms..

Edited by TNE26
Link to comment
Share on other sites

ok great.. I actually really needed them cause im having a LAN-party in a few hours, and wanted my WIP maps to be in it.. and as we all know.. the editor cant pack!! :P

Link to comment
Share on other sites

  • 4 weeks later...

Sweet, thanks for bringing this thing up again, I get asked on how to pack a mod way too often, now I can simply link here, or to the topic you will hopefully create in the BF2-Mods.de forum anytime soon :P I might go a step further and create an installer which reads your WinRar installation directory, lets you choose your mod's folder, modifies the bat files to match your WinRar folder and puts everything in your mod folder. Now I only need to know how that could be done, lmao. That would make it way easier. Anyone? :D

'pack_serverobjects.bat' only creates server_objects.zip and is useful for packing after 'code-only' tweaks.

I especially love this one, even though I already modified me the old one for doing this, yours makes it easier :)

Edited by wolfi
Link to comment
Share on other sites

  • 4 months later...
Do you know if it is possible to customize it to use 7-zip?

Should be able to.

Fire up CMD (or whatever console you use) and navigate to where 7z.exe (the 7-Zip executable) is and type the following command: 7z -?

All your command line options will be displayed.

You can add the path to 7z.exe to your PATH variable in your Environment Variables (in System Properties on the Advanced tab) so you don't have to type out the entire path to 7z.exe every time. Take note that it is delimited by a colon ( ; ) so you need to make sure there is one in place before your new path. You'll have to reboot for your changes to take effect but you should be able to access 7z no matter what directory your in now.

Edited by Xiann
Link to comment
Share on other sites

  • 5 months later...

I saw your script, and I'd like to improve one more thing:

The location of winrar.

I have a single .exe file (zip.exe) which can do everything winrar can do. (making zip and 7z archives)

I even made my own pack and unpack script, and it works!

Should I post the single file on filefront, and the link here?

Then you can include this file in your batch program, and then winrar doesn't even have to be installed ^_^

Edited by bergerkiller
Link to comment
Share on other sites

Just post it here :)

Great addition!

Link to comment
Share on other sites

Here is the link to the zip.exe:



If you want to pack all the files of the objects dir to a zip, you do this:

(I wrote this script, and it works, even with percentage indicator!)


@echo off
rem -----------------------objects pack-----------------------
zip.exe a -r -tzip objects_server.zip objects\*.con
zip.exe a -r -tzip objects_server.zip objects\*.tweak
zip.exe a -r -tzip objects_server.zip objects\*.Collisionmesh
zip.exe a -r -tzip objects_server.zip objects\*.Ai
zip.exe a -r -tzip objects_server.zip objects\*.baf
zip.exe a -r -tzip objects_server.zip objects\*.inc
zip.exe a -r -tzip objects_server.zip objects\*.tai
zip.exe a -r -tzip objects_server.zip objects\*.tac
zip.exe a -r -tzip objects_client.zip objects\*.staticmesh
zip.exe a -r -tzip objects_client.zip objects\*.Bundledmesh
zip.exe a -r -tzip objects_client.zip objects\*.skinnedmesh
zip.exe a -r -tzip objects_client.zip objects\*.dds
zip.exe a -r -tzip objects_client.zip objects\*.tga
zip.exe a -r -tzip objects_client.zip objects\*.ogg
zip.exe a -r -tzip objects_client.zip objects\*.wav
goto endprocess
rem ---------------------end of process---------------------

For unpacking the archives, use the following line:


@echo off
zip.exe x -o"output location" objects_server.zip

You could keep the {-o"output location"} out, but if you want to pack/unpack bf2142, it will be important!

The parameters:

7-Zip (A) 4.42 Copyright © 1999-2006 Igor Pavlov 2006-05-14

Usage: 7za <command> [<switches>...] <archive_name> [<file_names>...]

 a: Add files to archive
 d: Delete files from archive
 e: Extract files from archive (without using directory names)
 l: List contents of archive
 t: Test integrity of archive
 u: Update files to archive
 x: eXtract files with full paths
 -ai[r[-|0]]{@listfile|!wildcard}: Include archives
 -ax[r[-|0]]{@listfile|!wildcard}: eXclude archives
 -bd: Disable percentage indicator
 -i[r[-|0]]{@listfile|!wildcard}: Include filenames
 -m{Parameters}: set compression Method
 -o{Directory}: set Output directory
 -p{Password}: set Password
 -r[-|0]: Recurse subdirectories
 -scs{UTF-8 | WIN | DOS}: set charset for list files
 -sfx[{name}]: Create SFX archive
 -si[{name}]: read data from stdin
 -slt: show technical information for l (List) command
 -so: write data to stdout
 -t{Type}: Set type of archive
 -v{Size}[b|k|m|g]: Create volumes
 -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options
 -w[{path}]: assign Work directory. Empty path means a temporary directory
 -x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames
 -y: assume Yes on all queries

I offer myself to write a batch script for unpacking/packing files for bf2 and bf2142.


Well, I was bored, so I made this tool for packing and unpacking Battlefield 2 Archives:


It works the same as the one Mschoeldgen made, but now Winrar, 7z or similar doesn't have to be installed.

All the different Batch files have been converted into one file, with a simple menu.

If you like my zipper, or want something changed, post it in this Topic, and I may even make a version for Bf2142.

Edited by bergerkiller
Link to comment
Share on other sites

  • 2 weeks later...

I know, tga's will not be packed. I used the same exclude and include list files as the original files.

I only changed some parameters, and I made a menu.

It will do everything the original batches can. (except for the samples, I don't think you'll need those a lot)

Link to comment
Share on other sites

Mmm, true. But I don't think samples are necessary when you're going to publish a mod.

Should I add the samples option in my zipper anyways?


I'm currently learning visual basic, so maybe you can expect a zipper which isn't a batch very soon ;)

Edited by bergerkiller
Link to comment
Share on other sites

Mmm, true. But I don't think samples are necessary when you're going to publish a mod.

If you plan to create a package for fan mappers the samples are one of the things which they can't get if you don't supply them. Not all of the fans can affort to run 3DS to lightmap their fan map. So it really depends on your mod's intentions.

Should I add the samples option in my zipper anyways?

This script is really only necessary for the mod's 'master file manager' :P . If you include it note the users in your readme of its use and expect to get angry responses if the script simply overwrites 'Lightmapsamples04.zip' :D ( Which my version simply does, anyway )

Link to comment
Share on other sites

  • 1 month later...

Ok ms, I made my newest (vb) version of the Battlefield zipper.

I added the samples as filter, the 'master packer' can use it to get all the samples.

Newest improvement: It has support for Battlefield 2142. Yay! ;)

Some (secret) info for people who want to know how it works:

This prog is actually a huge compilation of small programs:

zip.exe = the 7z packer and unpacker

bfzippercancel.exe = can cancel the operation at all times

bfz_del.bat = can remove packed source files, with a lot of filters and options

loc.dat = made by the main launcher, contains the location where the zipper is

cancel.tmp = if it exists, the operation is aborted, made by bfzippercancel.exe

donedel.tmp = indicates whether the current file removal has finished, made by bfz_del.bat

All the above files will be stored in the temporary folder, in the 'bfzipper' subfolder.

The folder will be removed when the zipper closes.

More info here:

bfeditor bfzipper

Link to comment
Share on other sites

hi, I am noob in creating maps :-), But I create one my map..

And what i should do if i can pack my map to client.zip and server.zip please???

Can someone write easy tutorial ??? :-)


Please, can you write : 1.step, 2. step... while create client.zip and server.zip ? pls :-)

If i use pack_level.bat, it create client.zip and server zip but it have got 200 b

Edited by pipo03
Link to comment
Share on other sites

Wow, srry, but does anybody know what pipo03 is asking?

I understand it is about getting a level ingame, but what does the '200 b' mean?

Oh wait, I guess I understand. He packs a level using pack_level.bat, but it only results in two empty archives (200 bytes)

MM, ah I see. I made my own prog, totally forgot about the batches XD

Ok the steps:

1. Goto the location of the batches

2. Edit the pack_level.bat in notepad and change the levlename displayed there in the level you want to pack

3. Run the batches

You could also use my pack version, there it will do this on the fly.

Edited by bergerkiller
Link to comment
Share on other sites

The 'Batch_Scripts' folder must reside in the mod folder , not the map folder. In your case, put it into the /mods/bf2/ folder. Now open 'pack_level.bat' with notepad and edit the first line into cd /levels/CSa_Mesto

Note that the 'Batch_Scripts folder should simply stay in your mod folder all the time, there's no need to copy it . All the BAT files (pack_level.bat ) are in your mod folder.


The other batch files are for mod managers and modders working on objects.

Link to comment
Share on other sites

  • 2 weeks later...

Fixed 'pack_menu.bat' to include SWF's into menu_client.zip instead of menu_server.zip .

Shouldn't pose any problems, though as SWF'S are only fired on the client and the client does load menu_server.zip, too. But as our friends at DICE do pack SWF's into the client files, we do that now, too :P

Link to comment
Share on other sites

friends? what friends? :P

anyway, nice job.. re-dling! :)

Link to comment
Share on other sites


  • Create New...