1

Okay, I know this sounds odd but here is what I am trying to do.

  1. Find the boot class file of a phone via shell command. The boot class file is a list of APKs the phone needs to perform certainn operations
  2. Saving that list as text file on my PC. This text file will now contain .jar names such as core.jar, services.jar, sc.jar, etc.
  3. Loop through this text file and read the names one at a time.
  4. For each file name encountered on the text file, it will then go to the framework directory of the phone and copy the actual file the text references. For example....

If the first name on the text was "services.jar", it would then look into the correct directory of the phone and locate the actual file "services.jar" and copy it to a directory on the PC.

So far I have 1 and 2 worked out. I also know how to pull the file from the correct directory on the phone, I just dont know how to break the loop on each iteration to perform the search and copy function.

So right now here is how the BAT works....

adb shell echo $BOOTCLASSPATH > tmp.txt

Now I want to loop through that tmp.txt to see what names are on it and pull a file from another location based on the names it finds. If core.jar is on the text it pulls the actual core.jarfile from the phone.

If i use...

SETLOCAL ENABLEDELAYEDEXPANSION
for /f "usebackqdelims=" %%a in ("temp.txt") do (
SET file!index!=%%a
"what file did i find on this iteration?
"look in directory "X" on phone and copy that file to PC
....continue loop
ECHO !index! - %%a | more
SET /A index=!index!+1
)

to loop through the txt file, how can i stop at each iteration to pull the file associated with that name from different directory? So first loop through it finds core.jar, i then grab the actual core.jar from the phone. Second loop through it finds services.jar on the list, i then grab the actual services.jar from another location....etc.

Keep in mind the entire time this BAT is running my phone is connected to my PC via USB, otherwise it obviously would not work correctly.

I hope I have explained this clearly...its tough to describe.

Thanks, Jimmie

2
  • "pull a file from another location"??? What are you doing here? Copying, moving, opening... what are you doing with the file? Are the paths to files in the txt file? same folder?
    – Logman
    Aug 29, 2013 at 21:19
  • I am sorry for the confusion. Its difficult to explain correctly so I have edited my original post to try explain better exactly what I am trying to do. I hope it makes more sense. Thanks for looking. Aug 30, 2013 at 0:32

1 Answer 1

1

I figured it out....as always it was much simpler than expected.

Adding an xcopy inside the loop did the trick

xcopy "%%f" "tmp" /y >Null

So now the loop looks like this...

for /f "usebackqdelims=" %%a in ("temp.txt") do (
SET file!index!=%%a
xcopy "%%f" "tmp" /y >Null
ECHO !index! - %%a | more
SET /A index=!index!+1
)

Thanks......

You must log in to answer this question.

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