使用ResourceHacker以命令行方式更新应用程序图标

网上扒拉了一下,发现这玩意儿的命令行相关的介绍少之又少,找到的两个一个脚本之家的一个csdn的,内容一毛一样,反正就是不能用。

我这里用的是5.1.8版本的

在cmd或powershell中输入 ResourceHacker.exe -help commandline可以看到命令行具体用法,如下


====================================
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

替换图标的话只需要这一条就够了

ResourceHacker.exe -open "要更改图标的文件" -save "更改后保存的名称" -action addoverwrite -res "图标" -mask ICONGROUP,MAINICON,0

具体用法参照上面的就行,懒得翻译

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值