完成后使用批处理文件退出子例程

时间:2017-05-22 14:22:00

标签: batch-file cmd

我正在尝试使用jadx通过命令行对多个apk进行逆向工程。要执行此任务,请使用批处理文件。批处理文件中的命令是:

cd E:\MAL_DATASET\REV_CODE\DroidKungfu
MKDIR 0015ae7c27688d45f79170dcea16131ce557912a1a0c5f3b6b0465ee0774a452.apk
cd C:\Users\Home\Downloads\jadx-0.6.0\bin
cmd /C start /wait jadx -d E:\MAL_DATASET\REV_CODE\DroidKungfu\0015ae7c27688d45f79170dcea16131ce557912a1a0c5f3b6b0465ee0774a452.apk E:\MAL_DATASET\Derbin-data\chk_dir\DroidKungFu--------5\0015ae7c27688d45f79170dcea16131ce557912a1a0c5f3b6b0465ee0774a452.apk
cd E:\MAL_DATASET\REV_CODE\DroidKungfu
MKDIR 001e0f67b5bb9ddab14facbef94791eaed0eb939bcb651d19dafd0e2a05d8178.apk
cd C:\Users\Home\Downloads\jadx-0.6.0\bin
cmd /C start /wait jadx -d E:\MAL_DATASET\REV_CODE\DroidKungfu\001e0f67b5bb9ddab14facbef94791eaed0eb939bcb651d19dafd0e2a05d8178.apk E:\MAL_DATASET\Derbin-data\chk_dir\DroidKungFu--------5\001e0f67b5bb9ddab14facbef94791eaed0eb939bcb651d19dafd0e2a05d8178.apk
cd E:\MAL_DATASET\REV_CODE\DroidKungfu
MKDIR 00621e015191863041e78726b863b7e1374b17fda690367878d1272b0e44b232.apk
cd C:\Users\Home\Downloads\jadx-0.6.0\bin
cmd /C start /wait jadx -d E:\MAL_DATASET\REV_CODE\DroidKungfu\00621e015191863041e78726b863b7e1374b17fda690367878d1272b0e44b232.apk E:\MAL_DATASET\Derbin-data\chk_dir\DroidKungFu--------5\00621e015191863041e78726b863b7e1374b17fda690367878d1272b0e44b232.apk

我面临的问题是,每次执行启动/等待命令时,我都必须完全退出子进程窗口,如下图所示:enter image description here

有没有办法让这个过程自动化,即子过程自动退出。我尝试过cmd / C,但在这种情况下它不起作用。感谢。

2 个答案:

答案 0 :(得分:2)

您正在调用cmd / c并启动/等待这是没有意义的。

cd E:\MAL_DATASET\REV_CODE\DroidKungfu
MKDIR 0015ae7c27688d45f79170dcea16131ce557912a1a0c5f3b6b0465ee0774a452.apk
cd C:\Users\Home\Downloads\jadx-0.6.0\bin
start /wait jadx -d E:\MAL_DATASET\REV_CODE\DroidKungfu\0015ae7c27688d45f79170dcea16131ce557912a1a0c5f3b6b0465ee0774a452.apk E:\MAL_DATASET\Derbin-data\chk_dir\DroidKungFu--------5\0015ae7c27688d45f79170dcea16131ce557912a1a0c5f3b6b0465ee0774a452.apk
cd E:\MAL_DATASET\REV_CODE\DroidKungfu
MKDIR 001e0f67b5bb9ddab14facbef94791eaed0eb939bcb651d19dafd0e2a05d8178.apk
cd C:\Users\Home\Downloads\jadx-0.6.0\bin
start /wait jadx -d E:\MAL_DATASET\REV_CODE\DroidKungfu\001e0f67b5bb9ddab14facbef94791eaed0eb939bcb651d19dafd0e2a05d8178.apk E:\MAL_DATASET\Derbin-data\chk_dir\DroidKungFu--------5\001e0f67b5bb9ddab14facbef94791eaed0eb939bcb651d19dafd0e2a05d8178.apk
cd E:\MAL_DATASET\REV_CODE\DroidKungfu
MKDIR 00621e015191863041e78726b863b7e1374b17fda690367878d1272b0e44b232.apk
cd C:\Users\Home\Downloads\jadx-0.6.0\bin
start /wait jadx -d E:\MAL_DATASET\REV_CODE\DroidKungfu\00621e015191863041e78726b863b7e1374b17fda690367878d1272b0e44b232.apk E:\MAL_DATASET\Derbin-data\chk_dir\DroidKungFu--------5\00621e015191863041e78726b863b7e1374b17fda690367878d1272b0e44b232.apk

此外,您不必每次都使用CD来创建DIR,您可以一次关闭到bin,然后使用完整路径mkdir,每次只运行jadx

cd C:\Users\Home\Downloads\jadx-0.6.0\bin
MKDIR E:\MAL_DATASET\REV_CODE\DroidKungfu\0015ae7c27688d45f79170dcea16131ce557912a1a0c5f3b6b0465ee0774a452.apk
start /wait jadx -d E:\MAL_DATASET\REV_CODE\DroidKungfu\0015ae7c27688d45f79170dcea16131ce557912a1a0c5f3b6b0465ee0774a452.apk E:\MAL_DATASET\Derbin-data\chk_dir\DroidKungFu--------5\0015ae7c27688d45f79170dcea16131ce557912a1a0c5f3b6b0465ee0774a452.apk

MKDIR E:\MAL_DATASET\REV_CODE\DroidKungfu\001e0f67b5bb9ddab14facbef94791eaed0eb939bcb651d19dafd0e2a05d8178.apk
start /wait jadx -d E:\MAL_DATASET\REV_CODE\DroidKungfu\001e0f67b5bb9ddab14facbef94791eaed0eb939bcb651d19dafd0e2a05d8178.apk E:\MAL_DATASET\Derbin-data\chk_dir\DroidKungFu--------5\001e0f67b5bb9ddab14facbef94791eaed0eb939bcb651d19dafd0e2a05d8178.apk
MKDIR E:\MAL_DATASET\REV_CODE\DroidKungfu\00621e015191863041e78726b863b7e1374b17fda690367878d1272b0e44b232.apk
start /wait jadx -d E:\MAL_DATASET\REV_CODE\DroidKungfu\00621e015191863041e78726b863b7e1374b17fda690367878d1272b0e44b232.apk E:\MAL_DATASET\Derbin-data\chk_dir\DroidKungFu--------5\00621e015191863041e78726b863b7e1374b17fda690367878d1272b0e44b232.apk

甚至更好,在批处理文件中它会自动等待进程终止,因此不需要启动等待。并且因为您正在调用批处理,只需使用cmd / c

运行它
cd C:\Users\Home\Downloads\jadx-0.6.0\bin
MKDIR E:\MAL_DATASET\REV_CODE\DroidKungfu\0015ae7c27688d45f79170dcea16131ce557912a1a0c5f3b6b0465ee0774a452.apk
cmd /c jadx -d E:\MAL_DATASET\REV_CODE\DroidKungfu\0015ae7c27688d45f79170dcea16131ce557912a1a0c5f3b6b0465ee0774a452.apk E:\MAL_DATASET\Derbin-data\chk_dir\DroidKungFu--------5\0015ae7c27688d45f79170dcea16131ce557912a1a0c5f3b6b0465ee0774a452.apk

MKDIR E:\MAL_DATASET\REV_CODE\DroidKungfu\001e0f67b5bb9ddab14facbef94791eaed0eb939bcb651d19dafd0e2a05d8178.apk
cmd /c jadx -d E:\MAL_DATASET\REV_CODE\DroidKungfu\001e0f67b5bb9ddab14facbef94791eaed0eb939bcb651d19dafd0e2a05d8178.apk E:\MAL_DATASET\Derbin-data\chk_dir\DroidKungFu--------5\001e0f67b5bb9ddab14facbef94791eaed0eb939bcb651d19dafd0e2a05d8178.apk
MKDIR E:\MAL_DATASET\REV_CODE\DroidKungfu\00621e015191863041e78726b863b7e1374b17fda690367878d1272b0e44b232.apk
cmd /c jadx -d E:\MAL_DATASET\REV_CODE\DroidKungfu\00621e015191863041e78726b863b7e1374b17fda690367878d1272b0e44b232.apk E:\MAL_DATASET\Derbin-data\chk_dir\DroidKungFu--------5\00621e015191863041e78726b863b7e1374b17fda690367878d1272b0e44b232.apk

答案 1 :(得分:2)

您可以更轻松地调整和阅读批处理文件,例如:

@ECHO OFF
SET "srcDir=E:\MAL_DATASET\REV_CODE\DroidKungfu"
SET "binDir=%HOMEDRIVE%%HOMEPATH%\Downloads\jadx-0.6.0\bin"
SET "chkDir=E:\MAL_DATASET\Derbin-data\chk_dir\DroidKungFu--------5"
SET "APK1=0015ae7c27688d45f79170dcea16131ce557912a1a0c5f3b6b0465ee0774a452.apk"
SET "APK2=001e0f67b5bb9ddab14facbef94791eaed0eb939bcb651d19dafd0e2a05d8178.apk"
SET "APK3=00621e015191863041e78726b863b7e1374b17fda690367878d1272b0e44b232.apk"

CD/D "%binDir%"
FOR %%A IN ("%APK1%" "%APK2%" "%APK3%") DO (
    IF NOT EXIST "%srcDir%\%%~A\" MD "%srcDir%\%%~A"
    CMD/S /C"jadx -d "%srcDir%\%%~A" "%chkDir%\%%~A"")