From cd19587d66f6c30ac2bcb3b440bfc8786e4e77c7 Mon Sep 17 00:00:00 2001 From: Zetsu4i <79372809+Zetsu4i@users.noreply.github.com> Date: Sat, 29 Mar 2025 16:15:22 +0100 Subject: [PATCH 1/3] added apkeditor.bat a Windows batch script that wraps the tool, allowing you to run all its commands easily from the command line. It also provides color-coded output for better readability. --- apkeditor.bat | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 apkeditor.bat diff --git a/apkeditor.bat b/apkeditor.bat new file mode 100644 index 00000000..b50908a9 --- /dev/null +++ b/apkeditor.bat @@ -0,0 +1,29 @@ +@echo off +setlocal EnableDelayedExpansion + +:: colors +set "red=" +set "green=" +set "yellow=" +set "cyan=" +set "reset=" + +set "JAR_PATH=%~dp0APKEditor.jar" +if not exist "%JAR_PATH%" ( + echo %red%[ERROR] APKEditor.jar not found in %~dp0%reset% + exit /b 1 +) + +if "%~1"=="" ( + echo %yellow%APKEditor%reset% + + echo %cyan%Usage:%reset% apkeditor [command] [options] + echo %cyan%Commands:%reset% use %green% apkeditor -h %reset%- to see the available commands + echo %cyan%Example:%reset% apkeditor d -i app.apk + exit /b 0 +) + +echo %yellow%[INFO] Running command: java -jar APKEditor.jar %* %reset% +java -jar "%JAR_PATH%" %* + +exit /b %ERRORLEVEL% From c1a9f46de0ceedf5dca54aa32493c630b55771a6 Mon Sep 17 00:00:00 2001 From: Zetsu4i <79372809+Zetsu4i@users.noreply.github.com> Date: Sat, 29 Mar 2025 16:26:20 +0100 Subject: [PATCH 2/3] Update README.md added apkeditor docs --- README.md | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) diff --git a/README.md b/README.md index a22db76c..0b80c610 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,122 @@
👈 Click arrows to expand/collapse details on this page
+## Windows Batch Script Wrapper (`apkeditor.bat`) +This tool uses [ARSCLib](https://github.com/REAndroid/ARSCLib) to edit any apk resources and has six main features. +*(Tool documentation remains the same as provided in the prompt - Decompile, Build, Merge, Refactor, Protect, Info sections)* + +To make using `APKEditor.jar` more convenient on Windows, you can use the following batch script wrapper. It allows you to call the tool using a simple `apkeditor` command from anywhere in your terminal, provided you set it up correctly. + +### Features: +* **Easy Access:** Run `APKEditor.jar` using the `apkeditor` command. +* **PATH Integration:** Add the script's location to your system PATH for global access. +* **Argument Forwarding:** Passes all arguments directly to `APKEditor.jar`. +* **Colorized Output:** Uses ANSI escape codes for clearer console feedback (requires a compatible terminal like Windows Terminal, PowerShell 7+, Git Bash). +* **Built-in Help:** Shows basic usage or forwards to `APKEditor.jar -h` when no command or a help flag is provided. + +### Steps to Set Up: +1. **Download `APKEditor.jar`**: Get the latest release from the [Releases Page](https://github.com/REAndroid/APKEditor/releases/latest) and place `APKEditor.jar` in a dedicated folder (e.g., `C:\APKEditor\`). +2. **Save the Script**: Copy the code below and save it as `apkeditor.bat` in the *same folder* as `APKEditor.jar` (e.g., `C:\APKEditor\apkeditor.bat`). +3. **Add Folder to System PATH**: + * Search for "Environment Variables" in the Windows Start Menu and open "Edit the system environment variables". + * Click the "Environment Variables..." button. + * Under "System variables" (or "User variables" for just your user), find the `Path` variable, select it, and click "Edit...". + * Click "New" and add the full path to the folder where you saved the script and JAR (e.g., `C:\APKEditor`). + * Click "OK" on all open windows. + * **Important**: You may need to **close and reopen** any open Command Prompt or PowerShell windows for the PATH change to take effect. + +### Batch Script Code (`apkeditor.bat`): + +```batch +@echo off +setlocal EnableDelayedExpansion + +:: Define ESC character for ANSI sequences (works in most modern terminals) +for /F "tokens=1 delims=#" %%a in ('"prompt #$E# & echo on & for %%b in (1) do rem"') do set "ESC=%%a" + +:: Color definitions using ESC +set "red=%ESC%[91m" +set "green=%ESC%[92m" +set "yellow=%ESC%[93m" +set "cyan=%ESC%[96m" +set "reset=%ESC%[0m" +set "bold=%ESC%[1m" + +:: Find the JAR file next to the batch script +set "JAR_PATH=%~dp0APKEditor.jar" +if not exist "%JAR_PATH%" ( + echo %red%[ERROR]%reset% APKEditor.jar not found in %~dp0 + echo %yellow%Please place APKEditor.jar in the same directory as this script.%reset% + exit /b 1 +) + +:: Check for help flags or no arguments +set "SHOW_HELP=" +if "%~1"=="" set "SHOW_HELP=1" +if /I "%~1"=="-h" set "SHOW_HELP=1" +if /I "%~1"=="--help" set "SHOW_HELP=1" +if /I "%~1"=="/?" set "SHOW_HELP=1" + +if defined SHOW_HELP ( + echo %yellow%%bold%APKEditor Wrapper%reset% + echo. + echo %cyan%Usage:%reset% apkeditor [command] [options] + echo %cyan%Example:%reset% apkeditor d -i app.apk -o output_dir + echo. + echo %cyan%Available commands (from APKEditor.jar):%reset% + echo ------------------------------------------- + java -jar "%JAR_PATH%" -h + echo ------------------------------------------- + exit /b 0 +) + +:: Execute the command +echo %yellow%[INFO]%reset% Running: %cyan%java -jar "%JAR_PATH%" %*%reset% +echo. +java -jar "%JAR_PATH%" %* + +:: Propagate the exit code from java +exit /b %ERRORLEVEL% + +endlocal +``` + +### Usage Examples (using the wrapper): + +Now you can open **Command Prompt**, **PowerShell**, or **Windows Terminal** and use the tool like this: + +* **Get Help:** + ```sh + apkeditor -h + ``` +* **Decompile an APK:** + ```sh + apkeditor d -i myapp.apk -o myapp_json + ``` +* **Build APK from decompiled files:** + ```sh + apkeditor b -i myapp_json -o myapp_rebuilt.apk + ``` +* **Merge multiple APK files:** + ```sh + apkeditor m -i apks-folder -o merged_app.apk + ``` +* **Refactor obfuscated resources:** + ```sh + apkeditor x -i myapp.apk -o myapp_refactored.apk + ``` +* **Protect APK resources:** + ```sh + apkeditor p -i myapp.apk -o myapp_protected.apk + ``` +* **Get detailed APK information:** + ```sh + apkeditor info -v -resources -i myapp.apk + ``` + +### Notes: +* **Color Support:** ANSI color codes work best in modern terminals like **Windows Terminal**, **PowerShell 7+**, or **Git Bash**. They might appear as garbled text in older `cmd.exe` windows on older Windows versions. +* **Java Requirement:** Ensure you have a compatible Java Runtime Environment (JRE) installed and available in your system's PATH for the `java` command to work. + # APKEditor ### Powerful android apk resources editor This tool uses [ARSCLib](https://github.com/REAndroid/ARSCLib) to edit any apk resources and has six main features From b8d786a29f06202fef8e234f47d0c9efbc2374ca Mon Sep 17 00:00:00 2001 From: Zetsu4i <79372809+Zetsu4i@users.noreply.github.com> Date: Sat, 29 Mar 2025 16:27:34 +0100 Subject: [PATCH 3/3] fixed README.md --- README.md | 49 ++++++++++++++----------------------------------- 1 file changed, 14 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 0b80c610..1e0efe3e 100755 --- a/README.md +++ b/README.md @@ -30,54 +30,33 @@ To make using `APKEditor.jar` more convenient on Windows, you can use the follow @echo off setlocal EnableDelayedExpansion -:: Define ESC character for ANSI sequences (works in most modern terminals) -for /F "tokens=1 delims=#" %%a in ('"prompt #$E# & echo on & for %%b in (1) do rem"') do set "ESC=%%a" - -:: Color definitions using ESC -set "red=%ESC%[91m" -set "green=%ESC%[92m" -set "yellow=%ESC%[93m" -set "cyan=%ESC%[96m" -set "reset=%ESC%[0m" -set "bold=%ESC%[1m" - -:: Find the JAR file next to the batch script +:: colors +set "red=" +set "green=" +set "yellow=" +set "cyan=" +set "reset=" + set "JAR_PATH=%~dp0APKEditor.jar" if not exist "%JAR_PATH%" ( - echo %red%[ERROR]%reset% APKEditor.jar not found in %~dp0 - echo %yellow%Please place APKEditor.jar in the same directory as this script.%reset% + echo %red%[ERROR] APKEditor.jar not found in %~dp0%reset% exit /b 1 ) -:: Check for help flags or no arguments -set "SHOW_HELP=" -if "%~1"=="" set "SHOW_HELP=1" -if /I "%~1"=="-h" set "SHOW_HELP=1" -if /I "%~1"=="--help" set "SHOW_HELP=1" -if /I "%~1"=="/?" set "SHOW_HELP=1" - -if defined SHOW_HELP ( - echo %yellow%%bold%APKEditor Wrapper%reset% - echo. +if "%~1"=="" ( + echo %yellow%APKEditor%reset% + echo %cyan%Usage:%reset% apkeditor [command] [options] - echo %cyan%Example:%reset% apkeditor d -i app.apk -o output_dir - echo. - echo %cyan%Available commands (from APKEditor.jar):%reset% - echo ------------------------------------------- - java -jar "%JAR_PATH%" -h - echo ------------------------------------------- + echo %cyan%Commands:%reset% use %green% apkeditor -h %reset%- to see the available commands + echo %cyan%Example:%reset% apkeditor d -i app.apk exit /b 0 ) -:: Execute the command -echo %yellow%[INFO]%reset% Running: %cyan%java -jar "%JAR_PATH%" %*%reset% -echo. +echo %yellow%[INFO] Running command: java -jar APKEditor.jar %* %reset% java -jar "%JAR_PATH%" %* -:: Propagate the exit code from java exit /b %ERRORLEVEL% -endlocal ``` ### Usage Examples (using the wrapper):