An empty string can be created in DOS Scripting by assigning it no value during it’s initialization as shown in the following example.
To check for an existence of an empty string, you need to encompass the variable name in square brackets and also compare it against a value in square brackets as shown in the following example.
The following example shows how an empty string can be created and how to check for the existence of an empty string.
@echo off SET a= SET b=Hello if [%a%]== echo "String A is empty" if [%b%]== echo "String B is empty "
The above command produces the following output.
String A is empty