#1 11 Jun 2019 15:03

dino
New Member
Registered: 11 Jun 2019
Posts: 1

need help with batch file

hello everyone. i need to make a batch file out of these command but i can't seem to find a correct way to do this. i'm in need of your help.

i have a sh file that i send to phone's storage with adb shell and then execute it and all is fine. i just need to make a batch file out of this so that i don't have to send each command. here is the thing;

adb push myscript.sh /sdcard/myscript.sh
adb shell chmod 755 /sdcard/myscript.sh
adb shell
cd /sdcard/
./myscript.sh

now this don't work when i add these all in a batch file. works without batch file by sending command one by one.
after "adb shell" batch don't work, i think it is about changing directory within shell. so if anyone know can i make this in batch file would be really appreciated. thank you.

Offline

#2 11 Jun 2019 18:54

Simon Sheppard
Super Administrator
Registered: 27 Aug 2005
Posts: 1,038
Website

Re: need help with batch file

What OS are you running?

Offline

#3 12 Jun 2019 08:32

bluesxman
Member
From: UK
Registered: 29 Dec 2006
Posts: 1,100

Re: need help with batch file

Try this:

adb push myscript.sh /sdcard/myscript.sh
adb shell chmod 755 /sdcard/myscript.sh
adb shell /sdcard/myscripts.sh

If myscript.sh is trying to do things with relative directories that rely on your working directory being /sdcard you might need to add something like this near the top of myscript.sh:

cd "$(dirname "${0}")"

Last edited by bluesxman (12 Jun 2019 08:54)


cmd | *sh | Ruby | Chef

Offline

Board footer

Powered by FluxBB