How to detect the use of .bat files in Microsoft, the file is empty?

and print some command if the file is empty

+3
source share
1 answer

Here is an example of a batch file that does this. You call it the name of the file you want to check, empty or not:

@ECHO OFF

IF "%~z1"=="0" GOTO FileEmpty
ECHO File is not empty
GOTO End

:FileEmpty
ECHO File is empty

:End

Note that the file must exist for this to work. But you can easily check this withIF EXIST

+5
source

All Articles