Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I am writing a batch program using input environment variables. My problem deals with the dos limitation in comparing punctuation variables. Partial Example:
:: %KEY% CAN EQUAL ANY PUNTUATION
GETKEY
IF %KEY%==, SET Y=1
IF %KEY%==; SET Y=2
----------------
The following does not work. (Almost every other puntuation variable works). And I need to be able to compare all puntuation %variables%.
IF ,==, SET Y=1
IF ;==; SET Y=2
...I am completely stumped on how to work around this problem. I have been looking for different "freeware" programs to output different %variables% for the typed keys that can be compared using the IF statement, but the closest I've come is XSET 5.37 and that program is a @%&^ing "shareware" program that has a pause delay built in.
If nobody has any ideas then I'm just going to output the variables to a temp.txt file then do a running file compare/match on it. It's slower, but at least then I can continue my program.
For anyone that has a good workaround to my problem e-mail me and I'll make it worth your while.
Thanks in advance

Comparing files is a way around, but as you said, it's too slow. I know a work around that will not use files, just variables. You can use it to compare any sort of SETable strings (so, they may contain commas, semicolons, spaces, etc). It is not that simple, though:
:: Check if "%KEY%"==";"
set _;=
set _%KEY%=$
if "%_;%"=="$" echo TRUE!
if not "%_;%"=="$" echo FALSE!
set _%KEY%=It is a strange syntax, and is pretty counter-intuitive, but it works and you can understand it if you look at the code for a while.
I explained that method on the following thread:
http://www.computing.net/dos/wwwboard/forum/13310.html-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |