I am trying to check the size of a file using a batch file 'run.bat'. The batch script is-
setlocal
set file="C:\TestWorks\Project_Testing\new.template"
set maxbytesize=2000
FOR /F "usebackq" %%A IN ('%file%') DO set size=%%~zA
if %size% LSS %maxbytesize% (
echo File is ^< %maxbytesize% bytes
) else (
echo File is ^>= %maxbytesize% bytes
When I am running this it is not giving proper output, I am getting the output like this-
C:\TestWorks\Project_Testing>run.bat
C:\TestWorks\Project_Testing>set file="C:\TestWorks\Project_Testing\new.template
C:\TestWorks\Project_Testing>set maxbytesize=2000
C:\TestWorks\Project_Testing>FOR /F "usebackq" %A IN ('"C:\TestWorks\Project_Testing\bootstrap.bat.template"') DO set size=%~zA
C:\TestWorks\Project_Testing>set size=794
C:\TestWorks\Project_Testing>C:\TestWorks\Project_Testing>
What is going wrong here.