如何以编程方式忽略 WinRAR 警告?
How to ignore WinRAR warnings programatically?
我需要遍历很多 jar 文件来删除以前的标志并为每个 jar 重新制作标志,所以我为 windows 制作了这个脚本,它运行良好但是当 'Warning' 消息出现;而且我必须点击 'close' 很多次。警告是因为 "no file was found to delete".
@echo off
REM iterate over jar files in path
for %%x in (C:\My\Path\to\jar\files\*.jar) do (
echo Jar name: %%~nx
echo -------------------------------------
REM delete previous signatures
"C:\Program Files\WinRAR\WinRAR.exe" d %%x *.RSA *.SF
REM execute sign command
C:\My\Path\To\jarsigner.exe -keystore C:\My\Path\to\mykeystore.jks -storepass myStorepassKey -keypass myKeyspassKey %%x keys_alias
)
由于您正在编辑一个 .jar 文件,它本质上是一个 zip 文件,您可以避免使用 WinRAR。
zip
命令提供了删除 zip 文件中条目的方法。此外,如果您安装了 7zip(在 Windows 中可用),7z d archive.jar *.RSA -r
可能会成功。
另请参阅:How to delete a file from multiple zip archives using 7-Zip
如果我这样做 C:\Program Files\WinRAR\rar.exe /?
我得到了所有命令和开关,这意味着您应该使用 rar 来 运行:
"C:\Program Files\WinRAR\rar" d %%x *.RSA *.SF
Jar 文件实际上是压缩文件。
帮助输出:
<Commands>
a Add files to archive
c Add archive comment
ch Change archive parameters
cw Write archive comment to file
d Delete files from archive
e Extract files without archived paths
f Freshen files in archive
i[par]=<str> Find string in archives
k Lock archive
l[t[a],b] List archive contents [technical[all], bare]
m[f] Move to archive [files only]
p Print file to stdout
r Repair archive
rc Reconstruct missing volumes
rn Rename archived files
rr[N] Add data recovery record
rv[N] Create recovery volumes
s[name|-] Convert archive to or from SFX
t Test archive files
u Update files in archive
v[t[a],b] Verbosely list archive contents [technical[all],bare]
x Extract files with full path
您可以使用 -inul 选项。 -o+(强制覆盖)或 -o-(不覆盖)选项在提取过程中也可能有帮助。
我需要遍历很多 jar 文件来删除以前的标志并为每个 jar 重新制作标志,所以我为 windows 制作了这个脚本,它运行良好但是当 'Warning' 消息出现;而且我必须点击 'close' 很多次。警告是因为 "no file was found to delete".
@echo off
REM iterate over jar files in path
for %%x in (C:\My\Path\to\jar\files\*.jar) do (
echo Jar name: %%~nx
echo -------------------------------------
REM delete previous signatures
"C:\Program Files\WinRAR\WinRAR.exe" d %%x *.RSA *.SF
REM execute sign command
C:\My\Path\To\jarsigner.exe -keystore C:\My\Path\to\mykeystore.jks -storepass myStorepassKey -keypass myKeyspassKey %%x keys_alias
)
由于您正在编辑一个 .jar 文件,它本质上是一个 zip 文件,您可以避免使用 WinRAR。
zip
命令提供了删除 zip 文件中条目的方法。此外,如果您安装了 7zip(在 Windows 中可用),7z d archive.jar *.RSA -r
可能会成功。
另请参阅:How to delete a file from multiple zip archives using 7-Zip
如果我这样做 C:\Program Files\WinRAR\rar.exe /?
我得到了所有命令和开关,这意味着您应该使用 rar 来 运行:
"C:\Program Files\WinRAR\rar" d %%x *.RSA *.SF
Jar 文件实际上是压缩文件。
帮助输出:
<Commands>
a Add files to archive
c Add archive comment
ch Change archive parameters
cw Write archive comment to file
d Delete files from archive
e Extract files without archived paths
f Freshen files in archive
i[par]=<str> Find string in archives
k Lock archive
l[t[a],b] List archive contents [technical[all], bare]
m[f] Move to archive [files only]
p Print file to stdout
r Repair archive
rc Reconstruct missing volumes
rn Rename archived files
rr[N] Add data recovery record
rv[N] Create recovery volumes
s[name|-] Convert archive to or from SFX
t Test archive files
u Update files in archive
v[t[a],b] Verbosely list archive contents [technical[all],bare]
x Extract files with full path
您可以使用 -inul 选项。 -o+(强制覆盖)或 -o-(不覆盖)选项在提取过程中也可能有帮助。