I have created a new environment variable VerName in my system. Tried to execute the batch file through SQL Server. The log file was not displaying anything. As part of debugging, I have revisited the logic and just wrote the below command to check whether the value is coming from the query
EXEC master..xp_cmdshell '%VerName%'
That was displaying the below error
'%VerName%' is not recognized as an internal or external command, operable program or batch file. NULL
Am I doing something wrong?