After ApkTool executes the !name! variable no longer expands as expected. I'm not sure what's going on here nor how to fix it.
if not defined in_subprocess (cmd /k set in_subprocess=y ^& %0 %*) & exit @echo off setlocal ENABLEDELAYEDEXPANSION cd /d "%~dp0" for %%I in ("%~1") do ( set name="..\Compiled_apk\%%~nxI" apktool b "%%~I" -f -o "!name!.apk" zipalign -f 4 "!name!.apk" "!name!.temp" del "!name!.apk" ren "!name!.temp" "!name!.apk" apksigner sign -v --key "..\Program_Files\testkey.pk8" --cert "..\Program_Files\testkey.x509.pem" "!name!.apk" ) exit
apktoolis a script and since you're not usingcall, control never comes back to the main script after that point. Ifapktoolis a regular exe file, I've never heard of this happening and I don't understand how it's even possible.