Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 26th, 2012  |  syntax: None  |  size: 0.47 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Win bat file: How to get the result of FIND into a new variable?
  2. pdftk test.pdf dump_data | find "NumberOfPages"
  3.        
  4. "Number of pages: 32"
  5.        
  6. @ECHO OFF
  7. >testfile ECHO Number of pages: 32
  8. FOR /F "delims=: tokens=2" %%A IN ('TYPE testfile ^| FIND "Number of pages"') DO SET /A pagenum=%%A
  9. ECHO %pagenum%
  10.        
  11. 32
  12.        
  13. FOR /F "usebackq delims=" %%v IN (`pdftk test.pdf dump_data ^| find "Number of pages"`) DO (
  14.     FOR /F "delims=: tokens=1,2" %%i IN ("%%v") DO set NBPAGES=%%j
  15. )