迫于每次都要打开 Powershell 手动敲 adb install xxx.apk
太麻烦,就想通过注册表搞一个右键菜单,实现快捷安装 apk 的功能。
最后决定先实现三个功能:
可是对 windows 一窍不通,只能去网上抄代码。
照着几个现成的代码抄,又测了半天,最后发现无论是注册HKEY_CLASSES_ROOT\.apk\
还是HKEY_CLASSES_ROOT\apk_auto_file\
、无论配置SubCommands
还是直接在\.apk\shell
下面增加条目,都没办法在apk文件的右键中展示。
反正也是自己用,图方便就直接对HKEY_CLASSES_ROOT\*\
进行注册了。
调用的代码是Powershell -noexit ‘command‘
,第一次写 shell 代码,这个-noexit
还查了老半天。
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\Shell\ApkHelper]
"MUIVerb"="APK Helper"
"SubCommands"=""
"Position"="Center"
[HKEY_CLASSES_ROOT\*\shell\ApkHelper\Shell]
[HKEY_CLASSES_ROOT\*\shell\ApkHelper\Shell\InstallR]
@="adb install -r"
[HKEY_CLASSES_ROOT\*\shell\ApkHelper\Shell\InstallR\command]
@="PowerShell -noexit adb install -r \"%1\" "
[HKEY_CLASSES_ROOT\*\shell\ApkHelper\Shell\InstallT]
@="adb install -t"
[HKEY_CLASSES_ROOT\*\shell\ApkHelper\Shell\InstallT\command]
@="PowerShell -noexit adb install -r -t \"%1\" "
[HKEY_CLASSES_ROOT\*\shell\ApkHelper\Shell\SignNew]
@="Jarsigner"
[HKEY_CLASSES_ROOT\*\shell\ApkHelper\Shell\SignNew\command]
@="PowerShell -noexit jarsigner -verbose -keystore F:\Decompile\windows签名工具\Test.keystore -storepass 123456 -signedjar \"%1.signed.apk\" \"%1\" test -digestalg SHA1 -sigalg MD5withRSA "
原文:https://www.cnblogs.com/maiiiii/p/14473059.html