getVersionCode.bat 709 B

1234567891011121314151617181920212223242526272829
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. set "searchString=versionName"
  4. set "filePath=F:\AppSvn\branches\vnote_1.5.21\app\app\build.gradle"
  5. set versionName=1.5.21
  6. for /f "delims=" %%a in ('type "%filePath%"') do (
  7. echo %%a | findstr /C:"%searchString%" >nul
  8. if not errorlevel 1 (
  9. echo ============%%a
  10. rem 匹配版本号
  11. for /f "tokens=2" %%b in ('echo %%a') do (
  12. set myNumber=%%b
  13. )
  14. set replace=''
  15. set modifiedString=!myNumber:"=%replace%!
  16. echo =====modifiedString=!modifiedString!
  17. set "versionName=!modifiedString!"
  18. rem 在这里进行您想要的操作
  19. goto :exit_loop
  20. )
  21. )
  22. goto :eof
  23. :exit_loop
  24. echo =====2=======%versionName%
  25. pause