Gustavio said:
Hello,
I would like to know how to make the condition for an "if" allowing %%i to
be an integer only or go to exit.
Try testing the VariableContents for equality with +VariableContents,
this test is treated as True if the VariableContents are a numeric integer.
This demo shows the syntax, and uses ECHO commands for
illustration (you could replace them with GOTO commands to
to route flow to :EOF). The FOR statement tests four sample
tokens to report which are integers:
Lines that don't begin with two spaces have wrapped accidentally
====Begin cut-and-paste (omit this line)
@ECHO OFF
FOR /f "tokens=1-4" %%A IN ("1.5 2x text 1001") DO (
IF %%A EQU +%%A ECHO %%A is a integer
IF %%B EQU +%%B ECHO %%B is a integer
IF %%C EQU +%%C ECHO %%C is a integer
IF %%D EQU +%%D ECHO %%D is a integer
)
====End cut-and-paste (omit this line)
Simulated Win2000 for study/demo use. Cut-and-paste as Batch text file.
Batch file troubleshooting:
http://www.allenware.com/find?UsualSuspects
Screen capture shows operation:
============Screen capture Windows 2000 simulated in Win95
C:\WORK>demo
1001 is a integer
C:\WORK>
============End screen capture