我编写了简单的脚本来安装证书,将其保存为 install.bat。
certutil.exe -addstore "Root" "server.crt"
两个文件位于同一文件夹中:install.bat server.crt
右键单击 install.bat 并选择以管理员身份运行,闪烁非常快我看不出问题是什么但证书未安装。
如果我以管理员身份手动打开 Cmd 提示符,然后手动输入 install.bat,则证书已正常安装。
我不知道为什么。
答案1
当您从手动 cmd 运行脚本时,您CD
会进入正确的文件夹。以管理员身份运行批处理可能从 C:\Windows\System32 运行,因此找不到证书文件。将其放在pause
批处理脚本末尾以查看错误或timeout /t 20
答案2
解决方案:
certutil.exe -addstore "Root" "%~dp0server.crt"
pause
%~dp0 : this will append the full path to where your script and crt file are located pause : will pause the execution at this point to let you see what happens before the terminal window is closed.
答案3
您还可以在运行时通过将证书附加到您的 bat,使用 base64 并解码到临时文件夹来解码证书...
1)从文件 cer 进行 base64 编码:
%__AppDir__%certutil.exe -encode /f file.cer cert_b64.txt
2)将所有行移至cert_b64.txt
击球
-----BEGIN CERTIFICATE-----
Q2VydGlmaWNhdGU6CiAgICBEYXRhOgogICAgICAgIFZlcnNpb246IDMgKDB4MikK
.....in all lines .....
ajBGc2x4Y1ZLZFZqNWdsVmNTbWtMd1pLYkVVMU9Ld2xlVC9pWEZodm9vV2hRPT0K
LS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
-----END CERTIFICATE-----
3)string in base64
在你的蝙蝠中解码(%~f0)
为file.cer
,以便能够使用它:
%__appdir__%certutil -decode -f "%~f0" "%temp%\_My_Cert.cer"
4)"%temp%\_My_Cert.cer"
在您需要的任务中使用!
certutil.exe -addstore "Root" "%temp%\_My_Cert.cer"
alice.crt
请参阅下面的文件示例的使用示例这里:
@echo off
cd /d "%~dp0"
setlocal
%__appdir__%certutil.exe -decode /f "%~f0" "%temp%\_My_Cert.cer" 2>&1 >nul
:: here your code come to do more tasks, so, do anything you need
:: the last bat line needs to be like below for delete .\cert.cer
del /q /f "%temp%\_My_Cert.cer"
endlocal
goto :eof
rem :: your base64 attached file below, for multiple file use .zip
-----BEGIN CERTIFICATE-----
Q2VydGlmaWNhdGU6CiAgICBEYXRhOgogICAgICAgIFZlcnNpb246IDMgKDB4MikKICAgICAgICBTZXJpYWwgTnVtYmVyOiAxICgweDEpCiAgICAgICAgU2lnbmF0dXJl
IEFsZ29yaXRobTogc2hhMVdpdGhSU0FFbmNyeXB0aW9uCiAgICAgICAgSXNzdWVyOiBDPUZSLCBTVD1BbHNhY2UsIEw9U3RyYXNib3VyZywgTz13d3cuZnJlZWxhbi5v
cmcsIE9VPWZyZWVsYW4sIENOPUZyZWVsYW4gU2FtcGxlIENlcnRpZmljYXRlIEF1dGhvcml0eS9lbWFpbEFkZHJlc3M9Y29udGFjdEBmcmVlbGFuLm9yZwogICAgICAg
IFZhbGlkaXR5CiAgICAgICAgICAgIE5vdCBCZWZvcmU6IEFwciAyNyAxMDozMToxOCAyMDEyIEdNVAogICAgICAgICAgICBOb3QgQWZ0ZXIgOiBBcHIgMjUgMTA6MzE6
MTggMjAyMiBHTVQKICAgICAgICBTdWJqZWN0OiBDPUZSLCBTVD1BbHNhY2UsIE89d3d3LmZyZWVsYW4ub3JnLCBPVT1mcmVlbGFuLCBDTj1hbGljZS9lbWFpbEFkZHJl
c3M9Y29udGFjdEBmcmVlbGFuLm9yZwogICAgICAgIFN1YmplY3QgUHVibGljIEtleSBJbmZvOgogICAgICAgICAgICBQdWJsaWMgS2V5IEFsZ29yaXRobTogcnNhRW5j
cnlwdGlvbgogICAgICAgICAgICAgICAgUHVibGljLUtleTogKDQwOTYgYml0KQogICAgICAgICAgICAgICAgTW9kdWx1czoKICAgICAgICAgICAgICAgICAgICAwMDpk
ZDo2ZDpiZDpmODo4MDpmYTpkNzpkZToxYjoxZjphNzphMzoyZTpiMjoKICAgICAgICAgICAgICAgICAgICAwMjplMjoxNjpmNjo1MjowYTozYzpiZjphNjo0MjpmODpj
YTpkYzo5Mzo2NzoKICAgICAgICAgICAgICAgICAgICA0ZDo2MDpjMzo0Zjo4ZDpjMzo4YTowMDoxYjpmMTpjNDo0Yjo0MTo2YTo2OToKICAgICAgICAgICAgICAgICAg
ICBkMjo2OTplNTozZjoyMTo4ZTpjNTowYjpmODoyMjozNzphZDpiNjoyYzo0YjoKICAgICAgICAgICAgICAgICAgICA1NTpmZjo3YTowMzo3MjpiYjo5YTpkMzplYzo5
NjpiOTo1Njo5ZjpjYjoxOToKICAgICAgICAgICAgICAgICAgICA5OTpjOTozMjo5NDo2Zjo4ZjpjNjo1MjowNjo5Zjo0NTowMzpkZjpmZDplODoKICAgICAgICAgICAg
ICAgICAgICA5NzpmNjplYTpkNjpiYTpiYjo0ODoyYjpiNTplMDozNDo2MTo0ZDo1MjozNjoKICAgICAgICAgICAgICAgICAgICAwZjphYjo4Nzo1MjoyNTowMzpjZjo4
NzowMDo4NzoxMzpmMjpjYTowMzoyOToKICAgICAgICAgICAgICAgICAgICAxNjo5ZDo5MDo1Nzo0NjpiNTpmNDowZTphZToxNzpjODowYTo0ZDo5MjplZDoKICAgICAg
ICAgICAgICAgICAgICAwODphNjozMjoyMzoxMTo3MTpmZTpmMjoyYzo0NDpkNzo2YzowNzpmMzowYjoKICAgICAgICAgICAgICAgICAgICA3YjowYzo0YjpkZDozYjpi
NDpmNzozNzo3MDo5Zjo1MTpiNjo4ODo0ZTo1ZDoKICAgICAgICAgICAgICAgICAgICA2YTowNTo3Zjo4ZDo5Yjo2Njo3YTphYjo4MDoyMDpmZTplZTo2Yjo5NzpjMzoK
ICAgICAgICAgICAgICAgICAgICA0OTo3ZDo3ODozYjpkNTo5OTo5NzowMzo3NTpjZTo4ZjpiYzpjNTpiZTo5YzoKICAgICAgICAgICAgICAgICAgICA5YTphNToxMjox
OTo3MDpmOTphNDpiZDo5NjoyNzplZDoyMzowMjphNzpjNzoKICAgICAgICAgICAgICAgICAgICA1NzpjOTo3MTpjZjo3Njo5NDphMjoyMTo2MjpmNjpiODoxZDpjYTo4
ODplZToKICAgICAgICAgICAgICAgICAgICAwOTphZDo0NjoyZjpiNzo2MTpiMzoyYzoxNToxMzo4Njo5ZjphNTozNToyNjoKICAgICAgICAgICAgICAgICAgICA1YTo2
NzpmNDozNzpjODplNjo4MDowMTo0OTowZTpjNzplZDo2MTpkMzpjZDoKICAgICAgICAgICAgICAgICAgICBiYzplNDpmODpiZTozZjpjOTo0ZTpmODo3ZDo5Nzo4OTpj
ZToxMjpiYzpjYToKICAgICAgICAgICAgICAgICAgICBiNTpjNjpkMjplMDpkOTpiMzo2ODozYzoyZTo0YTo5ZDpiNDo1ZjpiODo1MzoKICAgICAgICAgICAgICAgICAg
ICBlZTo1MDozZDpiZjpkZDpkNDphMjo4YTpiNjphMDoyNzphYjo5ODowYzpiMzoKICAgICAgICAgICAgICAgICAgICBiMjo1ODo5MDplMjpiYzphMTphZDpmZjpiZDo4
ZTo1NTozMTowZjowMDpiZjoKICAgICAgICAgICAgICAgICAgICA2ODplOTozZDphOToxOTo5YTpmMDo2ZDowYjphMjoxNDo2YTpjNjo0YzpjNjoKICAgICAgICAgICAg
ICAgICAgICA0ZTpiZDo2MzoxMjphNTowYjo0ZDo5NzplYjo0MjowOTo3OTo1MzplMjo2NToKICAgICAgICAgICAgICAgICAgICBhYToyNDozNDo3MDpiODpjMTphYjoy
Mzo4MDplNzo5Yzo2YzplZDpkYzo4MjoKICAgICAgICAgICAgICAgICAgICBhYTozNzowNDpiODo0MzoyYTozZDoyYTphODpjYzoyMDpmYzoyNzo1ZDo5MDoKICAgICAg
ICAgICAgICAgICAgICAyNjo1ODpmOTpiNzoxNDplMjo5ZTplMjpjMTo3MDo3Mzo5NzplOTo2YjowMjoKICAgICAgICAgICAgICAgICAgICA4ZTpkMzo1Mjo1OTo3Yjow
MDplYzo2MTozMDpmMTo1NjozZjo5YzpjMTo3YzoKICAgICAgICAgICAgICAgICAgICAwNTpjNTpiMTozNjpjODoxODo4NTpjZjo2MTo0MDoxZjowNzplODphNzowNjoK
ICAgICAgICAgICAgICAgICAgICA4NzpkZjo5YTo3NzowYjphOTo2NDo3MjowMzpmNjo5MzpmYzplMDowMjo1OToKICAgICAgICAgICAgICAgICAgICBjMTo5NjplYzpj
MDowOTo0MjozZTozMDphMjo3ZjoxYjo0ODoyZjpmZTplMDoKICAgICAgICAgICAgICAgICAgICAyMTo4Zjo1Mzo4NzoyNTowZDpjYjplYTo0OTpmNTo0YTo5YjpkMDpl
Mzo1ZjoKICAgICAgICAgICAgICAgICAgICBlZTo3ODoxODplNTpiYTo3MTozMTphOTowNDo5ODowZjpiMTphZDo2Nzo1MjoKICAgICAgICAgICAgICAgICAgICBhMDpm
MjplMzo5YzphYjo2YTpmZTo1ODo4NDo4NDpkZDowNzozZDozMjo5NDoKICAgICAgICAgICAgICAgICAgICAwNToxNjo0NToxNTo5Njo1OTphMDo1ODo2YzoxODowZTpl
Mzo3Nzo2NjpjNzoKICAgICAgICAgICAgICAgICAgICBiMzpmNzo5OQogICAgICAgICAgICAgICAgRXhwb25lbnQ6IDY1NTM3ICgweDEwMDAxKQogICAgICAgIFg1MDl2
MyBleHRlbnNpb25zOgogICAgICAgICAgICBYNTA5djMgQmFzaWMgQ29uc3RyYWludHM6IAogICAgICAgICAgICAgICAgQ0E6RkFMU0UKICAgICAgICAgICAgTmV0c2Nh
cGUgQ29tbWVudDogCiAgICAgICAgICAgICAgICBPcGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZQogICAgICAgICAgICBYNTA5djMgU3ViamVjdCBLZXkgSWRlbnRp
ZmllcjogCiAgICAgICAgICAgICAgICA1OTo1RjpDOToxMzpCQToxQjpDQzpCOTpBODo0MTo0QTo4QTo0OTo3OTo2QTozNjpGNjo3RDozRTpENwogICAgICAgICAgICBY
NTA5djMgQXV0aG9yaXR5IEtleSBJZGVudGlmaWVyOiAKICAgICAgICAgICAgICAgIGtleWlkOjIzOjZDOjJEOjNEOjNFOjI5OjVEOjc4OkI4OjZDOjNFOkFBOkUyOkJC
OjJFOjFFOjZDOjg3OkYyOjUzCgogICAgU2lnbmF0dXJlIEFsZ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HdUMEdGeW9KTExCWmRISE1ISnowRjlIN0ZOazJ0VFFRTWhLNU1WWXdnK0xJYWVlNTg2
CkNRVnFmYnNjcDdldmxnakxXOThIKzV6eWxSSEFnb0gyRzc5YUhsak5LTXA5Qk91cTZTbkVnbEVzaVdHVnR1MmwKaG54OFNCM3NWSlpIZWVyOGYvVVFRd3FiQU8rS2R5
NzBObWJTYXFhVnRwOGpPeExpaWRXa3dTeVJUc3VVNkQ4aQpEaUg1dUVxQlhFeGpyajBGc2x4Y1ZLZFZqNWdsVmNTbWtMd1pLYkVVMU9Ld2xlVC9pWEZodm9vV2hRPT0K
LS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo= -----END CERTIFICATE-----
使用此代码将证书文件转换为字符串(base64),然后将输出放到剪贴板,然后将其粘贴到您需要的位置:
%__appdir__%certutil -encode /f .\my.crt "%temp%\_My_Cert.cer"
(for /f tokens^=* %%i in ('type "%temp%\_My_Cert.cer"')do echo/%%i)|clip
del /q /f "%temp%\_My_Cert.cer"
刚刚在你的文件中,clip
将输出发送到Ctrl+C
这是一些游戏批处理文件中使用的旧技术。