|This whole glob:|
if exist tmp\whatsapp.ab (
java -jar bin\abe.jar unpack tmp\whatsapp.ab tmp\whatsapp.tar
bin\tar xvf tmp\whatsapp.tar -C tmp\ apps/com.whatsapp/f/key
bin\tar xvf tmp\whatsapp.tar -C tmp\ apps/com.whatsapp/db/msgstore.db
bin\tar xvf tmp\whatsapp.tar -C tmp\ apps/com.whatsapp/db/wa.db
echo Extracting whatsapp.key ...
copy tmp\apps\com.whatsapp\f\key extracted\whatsapp.key
echo Extracting msgstore.db ...
copy tmp\apps\com.whatsapp\db\msgstore.db extracted\msgstore.db
echo Extracting wa.db ...
copy tmp\apps\com.whatsapp\db\wa.db extracted\wa.db
echo Pushing cipher key to: /sdcard/WhatsApp/Databases/.nomedia
bin\adb.exe push tmp\apps\com.whatsapp\f\key /sdcard/WhatsApp/Databases/.nomedia
echo Uploading cipher key to: http://whatcrypt.com/?cmd=_cryptkey
bin\curl.exe -s POST -F "keyfile=@extracted/whatsapp.key" -F "cmd=_uploadkey" http://whatcrypt.com/?cmd=_uploadkey
echo Cleaning up temporary files ...
del tmp\whatsapp.ab /s /q
del tmp\whatsapp.tar /s /q
del tmp\length.txt /s /q
del tmp\path.txt /s /q
del tmp\version.txt /s /q
rmdir tmp\apps /s /q
should be a subroutine. Any repetitive code over about half dozen lines should not be duplicated verbatim, because maintenance becomes twice (or more) the burden, and code volume increases. That has no direct relevance to your problem, but it saves time when trying to debug a script.
The other thing to watch out for is using unquoted elements in IF statements, because if one of the elements is undefined, you will get exactly the error you described. For example:
if %versionName% gtr 2.11.431 ...
will fail with "unexpected" if versionname is not defined, whereas:
if "%versionName%" gtr "2.11.431" ...
will allow the script to continue.
I spotted a few other anomalies in your script that might also be spoilers:
for /F "tokens=1" %%k in ("%version%") do (
Where in creation does %%v come from? Your tokens are only set to one (%%k).
and what is %%k? Unless it is something like: "a=b" then set %%k will only do a display of var.s beginning with %%k's value. It won't set anything.
Basic debugging for script: set "pause"s before each major operation and/or code-block, and use "echo" to analyze variable's values at key points. When you run the script, you'll see where it hangs up. If it hangs up between a certain set of pauses, then put more pauses between those to narrow it down. Use "echo" to identify the pause, such as:
echo check point one
hope this helps.
message edited by nbrane