[SOLVED] Add output message if file is empty [0 KB].
Posted: 19 Aug 2019 13:37
Good evening,
I have this piece of code . . .
. . . which works perfectly. What I can't figure out is how to include a message that says "NO ERRORS FOUND, deleting file." I have tried several IF...ELSE statements but can't quite get it right. If the file has data in then obviously there isn't a problem and the batch file displays the message "The file was created successfully". So, something like . . .
If the .txt file has data then output the message "The file was created successfully"
If the .txt file doesn't have data then output the message "NO ERRORS FOUND, deleting file.".
I was going to post the things I have tried but there has been quite a few!!!
Thanks in advance.
I have this piece of code . . .
Code: Select all
for %%R in ("%userprofile%\Desktop\x.txt") do if %%~zR equ 0 del "%userprofile%\Desktop\x.txt"
If the .txt file has data then output the message "The file was created successfully"
If the .txt file doesn't have data then output the message "NO ERRORS FOUND, deleting file.".
I was going to post the things I have tried but there has been quite a few!!!
Thanks in advance.