How to check if a variable exists in a batch file?

IF "%Variable%"=="" ECHO Variable is NOT defined

This should help but this works, provided the value of Variable does not contain double quotes.
Or you may try. Both worked for me.

VERIFY OTHER 2>nul
SETLOCAL ENABLEEXTENSIONS
IF ERRORLEVEL 1 ECHO Unable to enable extensions
IF DEFINED MyVar (ECHO MyVar IS defined) ELSE (ECHO MyVar is NOT defined)
ENDLOCAL

source http://www.robvanderwoude.com/battech_defined.php

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)