code_junkie

How can I load the contents of a text file into a batch file variable?

Nov 11th, 2011
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. SetLocal EnableDelayedExpansion
  2. set content=
  3. for /F "delims=" %%i in (test.txt) do set content=!content! %%i
  4.  
  5. echo %content%
  6. EndLocal
  7.  
  8. set content=
  9. for /f "delims=" %%i in ('filename') do set content=%content% %%i
  10.  
  11. set content=
  12. for /f "delims=" %%i in ('type text.txt') do set content=!content! %%i
  13.  
  14. for /f "tokens=1 delims=" %%i in (file.txt) do echo %%i
  15.  
  16. for /f "tokens=1 delims=" %%i in (file.txt) do call :part2 %%i
  17. goto :fin
  18.  
  19. :part2
  20. echo %1
  21. ::do further processing here
  22. goto :eof
  23.  
  24. :fin
  25.  
  26. set FileContents=
  27.  
  28. @echo off
  29. copy SetFile.bat + %1 $tmp$.bat > nul
  30. call $tmp$.bat
  31. del $tmp$.bat
Add Comment
Please, Sign In to add comment