Solved Help with Array Question

June 21, 2016 at 23:37:37
Specs: WinXP, P4 2.2Ghz
My batch file is following
set Arr[0]=apple
IF NOT %%Arr[0]%% == apple echo NO
IF %%Arr[0]%% == apple echo YES

My question is why the result gave me 'NO'.
In my logic, it should be YES.

Can you please explain it to me?

Computer Programmer

message edited by aha

See More: Help with Array Question

Reply ↓  Report •

June 22, 2016 at 00:09:13
✔ Best Answer
First, the value of a var is %var% NOT %%var%%.

Next, you need to wring out the superfluous spaces.

if %var%==abc
if %var% == abc


M2 Get custom script or take private lessons

Reply ↓  Report •

June 22, 2016 at 16:05:45
Hi Mechanix2Go,

Thank you very much! You did help me again.
I remember you, my friend!

Many years ago, you help me with a FTP script.
At that time I remember M2. As I saw your reply, I immediately recall your name again.

You make my day!
Appreciate your help!


Computer Programmer

Reply ↓  Report •

Related Solutions

Ask Question