0

In Windows, it is possible to use a "bat" file format that reads and processes written commands, such as a command to open the Windows Calculator (which you can also do via CMD).

Is this also possible on Android? If yes, which app and which Android command library can I use?

1
  • Try Termux app. Read about it. Try it. Keep trying it. That's all.
    – Firelord
    Jun 26, 2022 at 10:45

2 Answers 2

1

Since Android is a linux-based Operating System, it would be shell scripts (.sh) instead of batch files, probabiy run with sh, a bash like shell located in /system/bin/sh

To open applications using a shell script you would need root access and can use a terminal emulator like termux.

First of all, grant termux full storage rights

termux-setup-storage

To launch apps, you must write commands using Activity Manager

For instance, to launch calculater (I'm using Google Calculator for the guide) using a shell script in android, the procedure would be this

  1. Create a file eg calc.sh in /storage/emulated/0 ie the user-accessible part of your internal storage, with the following content
#!/system/bin/sh  
am start com.google.android.calculator/com.android.calculator2.Calculator  
  1. Open Termux
cd /storage/emulated/0  
sh calc.sh  
  1. The calculator should launch

Bonus: You can also execute commands on android using your PC via ADB

0
0

Use a terminal emulator like Termux to run shell scripts.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .