IF condition is completly ignored, but why?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
jeb
Expert
Posts: 1055
Joined: 30 Aug 2007 08:05
Location: Germany, Bochum

Re: IF condition is completly ignored, but why?

#16 Post by jeb » 08 Jun 2011 00:05

dbenham wrote:The problem exists for all of the = variables. The only way I have gotten any of them to work is with quotes. No other character(s) seem to work. Very odd :?

The quotes are not necessary.

A simple caret do the job

Code: Select all

if !^=exitCode!==00000000 echo OK
if !str:the^=It! == testIt


jeb

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: IF condition is completly ignored, but why?

#17 Post by dbenham » 08 Jun 2011 15:15

Ok they are not necessary, but they do help :!:
Without quotes or escape the command fails.

Dave

Post Reply