ESCAPE Character Problem

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
skaa
Posts: 4
Joined: 25 Jun 2010 09:11
Location: USA
Contact:

ESCAPE Character Problem

#1 Post by skaa » 25 Jun 2010 09:37

Hi,

This code:

set sfv=ab,cd
set sfvi=%sfv%
if [%sfvi%]==[] echo pppppppppppppppppp

gives me this response:

C:\business\Batch\Env\envString>set sfv=ab,cd
C:\business\Batch\Env\envString>set sfvi=ab,cd
cd]==[] was unexpected at this time.
C:\business\Batch\Env\envString>if [ab,cd]==[] echo pppppppppppppppppp

. How to escape (,) character to avoid "cd]==[] was unexpected at this time." error message?

Thanks.

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: ESCAPE Character Problem

#2 Post by aGerman » 25 Jun 2010 12:38

The comma is a delimiter (similar to a space character). Use double quotes instead of square brackets.

Code: Select all

set sfv=ab,cd
set sfvi=%sfv%
if "%sfvi%"=="" echo pppppppppppppppppp


Regards
aGerman

skaa
Posts: 4
Joined: 25 Jun 2010 09:11
Location: USA
Contact:

Re: ESCAPE Character Problem

#3 Post by skaa » 25 Jun 2010 15:26

Thank you!!! It works.

Post Reply