|
Answer» Hi!
I created a batch file to list every .apk file inside that same directory!
with the code:
Code: [Select]@echo for /r . %%g in (*.apk) do echo %%~nxg >> list.txt The final listing (list.txt) is for example:
Code: [Select]AccuweatherDaemon.apk AccuWeatherDaemonService.apk AccuweatherWidget.apk AccuweatherWidget_Main.apk After i get this listing i created another batch to create a specific code to create specific list for the files inside the list.txt:
Code: [Select]@echo off for /F "TOKENS=*" %%A in (list.txt) do ( echo.symlink("/preload/symlink/system/app/%%~nA.apk","/system/app/%%~nA.apk"); >> symlinks.txt ) And i wanted the final listing to appear as:
Code: [Select]symlink("/preload/symlink/system/app/AccuweatherDaemon.apk","/system/app/AccuweatherDaemon.apk"); symlink("/preload/symlink/system/app/AccuWeatherDaemonService.apk","/system/app/AccuWeatherDaemonService.apk"); symlink("/preload/symlink/system/app/AccuweatherWidget.apk","/system/app/AccuweatherWidget.apk"); symlink("/preload/symlink/system/app/AccuweatherWidget_Main.apk","/system/app/AccuweatherWidget_Main.apk"); But what i get is:
Code: [Select]symlink("/preload/symlink/system/app/AccuweatherDaemon.apk","/system/app/AccuweatherDaemon.apk" symlink("/preload/symlink/system/app/AccuWeatherDaemonService.apk","/system/app/AccuWeatherDaemonService.apk" symlink("/preload/symlink/system/app/AccuweatherWidget.apk","/system/app/AccuweatherWidget.apk" symlink("/preload/symlink/system/app/AccuweatherWidget_Main.apk","/system/app/AccuweatherWidget_Main.apk" Somehow the ); is getting ignored!
Anyone know how to fix it?
ThanksCode: [Select]@echo off for /f "tokens=*" %%A in (list.txt) do ( echo.symlink("/preload/symlink/system/app/%%~nA.apk","/system/app/%%~nA.apk"^); >> symlinks.txt ) Add an escape character ^ before the ) close parentheses character. ) is being interpreted as the end of the LOOP because it is a special character. Escaping NEEDS to be done for all special characters used as literals not contained within double quotations.I was just replying my own post with the exact same SOLUTION as you provided my friend!
I remembered about the special characters too!
And then i found this post:
http://stackoverflow.com/questions/10021464/batch-file-to-add-characters-to-beginning-and-end-of-each-line-in-txt-file
Which clarified everything to me
Thanks for your help!
|