Batch file Examples (using rh.exe instead of ResourceHacker.exe in places for brevity)
reshack_help.bat:
ResourceHacker.exe -help
@pause :: to see the console output before the CMD window closes.
reshack_compile_res_script.bat:
rh.exe -open .\in\resources.rc -save .\out\resources.res -action compile -log NUL
reshack_add_icon_to_old.bat:
rh.exe -open old.exe -save new.exe -action addskip -res my.ico -mask ICONGROUP,MAINICON,
reshack_extract_all_source_icons_to_icons_folder.bat:
rh.exe -open source.exe -save .\icons -action extract -mask ICONGROUP,, -log CON
@pause
reshack_extract_all_dialogs.bat:
rh.exe -open source.exe -save .\dialogs.rc -action extract -mask DIALOG,, -log rh.log
reshack_execute_my_script.bat:
ResourceHacker.exe -script myscript.txt
Resource Hacker™ Scripts:
Resource Hacker™ Scripts are executed from the command-line using the following syntax:
ResourceHacker.exe -script ScriptFile
Resource Hacker™ Scripts are text files with the following format:
//comments are preceded by double slashes
[FILENAMES]
Open=
Save=
Log=
[COMMANDS]
//one or more of the following commands ...
-add SourceFile, ResourceMask
-addskip SourceFile, ResourceMask
-addoverwrite SourceFile, ResourceMask
-addoverwrite SourceFile, ResourceMask
-modify SourceFile, ResourceMask
-extract TargetFile or TargetFolder, ResourceMask
-delete ResourceMask
-changelanguage(langID)
Note: Filenames that include spaces must be enclosed within double quotes.
Resource Hacker™ Script examples:
rh_script_myprog_rus.txt -
//This script deletes all Language Neutral (0)
//string-table, menu and dialog resource items
//in MyProg.exe before replacing them
//with Russian (1049) items...
[FILENAMES]
Exe= MyProg.exe
SaveAs= MyProg_Rus.exe
Log= MyProg_Rus.log
[COMMANDS]
-delete MENU,,0
-delete DIALOG,,0
-delete STRINGTABLE,,0
-add MyProg_Rus.res, MENU,,1049
-add MyProg_Rus.res, DIALOG,,1049
-add MyProg_Rus.res, STRINGTABLE,,1049
rh_script_myprog_upd_images.txt -
//This script updates 2 bitmaps and an
//icon in MyProg.exe ...
[FILENAMES]
Exe= MyProg.exe
SaveAs= MyProg_Updated.exe
[COMMANDS]
-addoverwrite Bitmap128.bmp, BITMAP,128,
-addoverwrite Bitmap129.bmp, BITMAP,129,0
-addoverwrite MainIcon.ico, ICONGROUP,MAINICON,0
rh_script_myprog_upd_all.txt -
//This script replaces all resources
//in MyProg.exe with all the resources
//in MyProgNew.res
[FILENAMES]
Exe= MyProg.exe
SaveAs= MyProg_Updated.exe
[COMMANDS]
-delete ,,, //delete all resources before...
-add MyProgNew.res ,,, //adding all the new resources