|
可以的,命令行运行
- ResourceHacker.exe -help commandline
- ResourceHacker.exe -help script
复制代码
可以得到用法帮助。
- ====================================
- Resource Hacker Command Line Syntax:
- ====================================
- Command line instructions ...
- Switch Parameter
- ========= ====================================================================
- -open : filename - the name of the file that is to be modified ...
- Windows PE file (*.exe, *.dll etc) or resouce file (*.res or *.rc)
- -save : filename - the new name of the modified or newly created file ...
- either a modified opened file or an extracted resource
- -resource: filename - contains a resource being added to the opened file.
- -action : action to be performed on the opened file
- add - add a resource, fails if it already exists
- addoverwrite - add a resource, overwrites if it already exists
- addskip - add a resource, skips if it already exists
- compile - compiles a text resource file (*.rc)
- delete - delete a resource
- extract - extract a resource
- modify - modify a resource
- changelanguage(langID) - changes the language of ALL resources (nb: avoid any spaces)
- -mask : resource mask - Type,Name,Language
- commas are mandatory but each of type, name & language are optional
- -log : filename or CONSOLE or NUL
- CONSOLE: can be abbreviated to CON
- logs details of the operation performed
- switch is optional - if omited, defaults to resourcehacker.log
- -script : filename - contains a multi-command script, NOT a resource script
- for more info: -help script
- other switches are ignored.
- -help : options - commandline or script (always logged to CONSOLE)
- other switches are ignored.
- ========= ====================================================================
- Notes:
- 1. Switch identifiers may be abbreviated down to a single char (eg -res or -r).
- 2. Switch instructions do not have to be in any particular order.
- 3. File names that contain spaces must be encased within double quotes.
- 4. The changelanguage action changes the language ID of ALL resources irrespective of any mask.
- Batch file Examples:
- ====================
- CommandlineInstructions.bat:
- ResourceHacker.exe -help commandline
- @pause :: and let's see the console output before the CMD window closes :)
- Compile.bat:
- ResourceHacker.exe -open resources.rc -save resources.res -action compile -log NUL
- AddIcon.bat:
- ResourceHacker.exe -open ".\In\old.exe" -save ".\Out\new.exe" -action addskip -res ".\In\missing.ico" -mask ICONGROUP,MAINICON,
- ExtractIcon.bat:
- ResourceHacker.exe -open source.exe -save savedicon.ico -action extract -mask ICONGROUP,MAINICON, -log CONSOLE
- @pause
- ExtractAllIcons.bat:
- ResourceHacker.exe -open source.exe -save savedicons.rc -action extract -mask ICONGROUP,, -log savedicons.log
- RunScript.bat:
- ResourceHacker.exe -script myscript.txt
- ====================================
- Resource Hacker Script Syntax:
- ====================================
- ResourceHacker.exe -script filename
- A script file is a text file with the following layout:
- =======================================================
- //comments are preceded by double slashes
- [FILENAMES]
- Open=
- Save=
- Log=
- [COMMANDS]
- //one or more of the following commands ...
- -add ResourceSrc, ResourceMask
- -addskip ResourceSrc, ResourceMask
- -addoverwrite ResourceSrc, ResourceMask
- -addoverwrite ResourceSrc, ResourceMask
- -modify ResourceSrc, ResourceMask
- -extract ResourceTgt, ResourceMask
- -delete ResourceMask
- -changelanguage(langID)
- =======================================================
- Notes:
- Filenames that include spaces must be enclosed within double quotes.
- ResourceSrc and ResourceTgt represent filenames.
- The changelanguage() action changes the language ID of ALL resources
- ResourceMask:
- Format - Type,Name,Language
- Each of Type, Name & Language are optional but the 2 commas are mandatory.
- 'Type' may be either an integer or text but text should be encased within
- double quotes to differentiate it from integer identifiers.
- 'Name' if defined may be either an integer or text.
- 'Language' if defined must be an integer.
- Predefined Resource Type identifiers are listed here:
- [https://]msdn.microsoft.com/en-us/library/windows/desktop/aa381043.aspx
- Log:
- Can be either a filename or CONSOLE or NUL
- It's optional and if it's omitted defaults to resourcehacker.log.
- =======================================================
- Example 1: 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 language items...
- [FILENAMES]
- Open = MyProg.exe
- Save = MyProg_Rus.exe
- Log = CONSOLE
- [COMMANDS]
- -delete MENU,,0
- -delete DIALOG,,0
- -delete STRINGTABLE,,0
- -add MyProg_Rus.res, MENU,,
- -add MyProg_Rus.res, DIALOG,,
- -add MyProg_Rus.res, STRINGTABLE,,
- -changelanguage(1049)
- Example 2: 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
- Example 3: 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
复制代码 |
|