I have a batch script which is trying to read the content of a text file into a variable Err_stat.
I used the below code to read the file content and store to Err_stat. But when I run the code, instead of reading the file content to the variable, the text file is getting opened in the notepad. below is the code I used
for /f "delims=" %%i in ('Err_log.txt') do set Err_stat=%%i
echo %Err_stat%
I tried with the below code as well, but it returns a special character and the first character of the text file to the variable.
set /p Err_stat=<Excel_err_log.txt
echo %Err_stat%
Any one know, what is the error in my code?