批处理调用Rcedit 修改exe或dll详细信息(版本、版权)

官方仓库:https://github.com/electron/rcedit

版本列表:https://github.com/electron/rcedit/releases

Gitee国内仓库地址:https://gitee.com/freeasm/rcedit


官方文档示例

显示帮助:

$ rcedit -h

设置版本字符串:

$ rcedit "path-to-exe-or-dll" --set-version-string "Comments" "This is an exe"

设置文件版本:

$ rcedit "path-to-exe-or-dll" --set-file-version "10.7"

设置产品版本:

$ rcedit "path-to-exe-or-dll" --set-product-version "10.7"

设置图标:

$ rcedit "path-to-exe-or-dll" --set-icon "path-to-ico"

设置资源字符串:

$ rcedit "path-to-exe-or-dll" --set-resource-string id_number "new string value"

设置请求的执行级别 ( | |) 在清单中:asInvokerhighestAvailablerequireAdministrator

$ rcedit "path-to-exe-or-dll" --set-requested-execution-level "requireAdministrator"

设置应用程序清单

$ rcedit "path-to-exe-or-dll" --application-manifest ./path/to/manifest/file

您可以在一个命令中更改多个内容:

$ rcedit "path-to-exe-or-dll" --set-icon "path-to-ico" --set-file-version "10.7"

获取版本字符串:

$ rcedit "path-to-exe-or-dll" --get-version-string "property"

使用与 相同的属性。用于获取 的结果和获取 的结果。--set-version-string"FileVersion"--set-file-version"ProductVersion"--get-product-version

获取资源字符串:

$ rcedit "path-to-exe-or-dll" --get-resource-string id_number

命令解读

PS D:\01_soft\rcedit> .\rcedit.exe -h
Rcedit v0.2.0: Edit resources of exe.

Usage: rcedit <filename> [options...]

Options:
  -h, --help                                 Show this message
  --set-version-string <key> <value>         Set version string
  --get-version-string <key>                 Print version string
  --set-file-version <version>               Set FileVersion
  --set-product-version <version>            Set ProductVersion
  --set-icon <path-to-icon>                  Set file icon
  --set-requested-execution-level <level>    Pass nothing to see usage
  --application-manifest <path-to-file>      Set manifest file
  --set-resource-string <key> <value>        Set resource string
  --get-resource-string <key>                Get resource string
  --set-rcdata <key> <path-to-file>          Replace RCDATA by integer id

rc文件

在win32编程中,为方便项目中的资源统一管理,提供了一个格式统一的资源文件,对各种资源进行管理。它的扩展名是.rc,在程序编译时它会被资源编译器编译生成一个.res的二进制文件。

.rc文件示例

IDI_ICON1 ICON "CAJviewer.ico"

#if defined(UNDER_CE)
#include <winbase.h>
#else
#include <winver.h>
#endif

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,1,1,2245
 PRODUCTVERSION 1,1,1,0
 FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x40004L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "080404b0"
        BEGIN
            VALUE "CompanyName", "XXXXXX科技有限公司"
            VALUE "ESCAJviewerInternalVersion", "1.1.1.0-RC02"
            VALUE "FileDescription", "CAJviewer"
            VALUE "FileVersion", "1.1.1.2245"
            VALUE "InternalName", "CAJviewer"
            VALUE "LegalCopyright", "Copyright(C)2023 XXXXXX Technology Co., LTD. All Rights Reserved."
            VALUE "OriginalFilename", "CAJviewer.exe"
            VALUE "ProductName", "XXXXXX CT图像处理软件"
            VALUE "ProductVersion", "V1.1.1-b5"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x804, 1200
    END
END

批处理调用rcedit示例代码

(项目中已在使用)

chcp 65001
@echo off


REM FileDescription 文件说明
REM FileVersion 	文件版本
REM ProductName		产品名称
REM ProductVersion 	产品版本
REM LegalCopyright	版权
REM ICON			图标

set FileDescription="CAJviewer"
set FileVersion=1.1.0.1211
set ProductName="XXXXXXCT图像处理软件"
set ProductVersion="V1.0.0"
set LegalCopyright="Copyright(C) 2022 XXXXXX Technology Co., LTD. All Rights Reserved."
set ICON=D:\Packge\CAJviewer.ico

REM 切换至exe目录
cd D:\Packge\CSJViewer\bin

REM 修改属性详细信息,^为换行符
D:\01_soft\rcedit\rcedit.exe "CAJviewer.exe"^
 --set-version-string FileDescription %FileDescription%^
 --set-file-version %FileVersion%^
 --set-version-string ProductName %ProductName%^
 --set-version-string ProductVersion %ProductVersion%^
 --set-version-string LegalCopyright %LegalCopyright%^
 --set-version-string OriginalFilename %FileDescription%^
 --set-icon %ICON%

批处理变量对应exe详细信息

注意:ico图标修改后文件夹的图标没有立即显示。可以剪切换个位置就显示出来了。

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值