===== CMD BATCH FILE=====
I am trying to check a variable=="string" then echo message and run program else it must quit exit 1 if anything else or even empty.
I have tried so much already and used Google, but I just seem to continually receive syntax errors and unexpected at this time errors, CMD is really a struggle to troubleshoot although it is pretty old and yet powerful.
So what i am trying to understand is what is wrong with my brackets or structure, because it is telling me ( was unexpected or syntax error or was not expected yet... anoying.
My structure like:
echo off
if "%1"=="imre" goto imre (
echo found parameter "%1"
) else if NOT %1=="imre" echo you failed
just not working; I get
( was unexpected
and other syntax errors if I try to tweak this...
All I want is to: (this is what i have written but it is not working)
if %variable%=="hello" (
echo hello is correct
echo now lets start this program
start /w excel.exe
) else (
exit 1
)
This does not work, and I don't understand what I am doing wrong. this is CMD Batch which is am trying to achieve