Batch file file read

 

Batch file - read file into variable


@echo OFF
rem Has about 1024 character buffer limit
rem See: https://stackoverflow.com/questions/3068929/how-to-read-file-contents-into-a-variable-in-a-batch-file
echo Hello File > file.txt
set /p ReadBack=<file.txt
echo Text is %Readback%

Outputs: Text is: Hello File

Comments

Popular posts from this blog

QTreeView and QTableView dynamic changes

C++ strings and string_view