I want to find the string "ACCESS" in CheckV.TXT. If found, assign it to variable ACCESS. If not found, assign the value "NO" to the variable. But after running, using ECHO %ACCESS% can't display the changed variable, indicating that the variable NO was not assigned to ACCESS. I don't know where the error is. I ask for expert guidance.
My code is as follows:
@ECHO OFF
FOR /F %%I IN ('FINDSTR /I "ACCESS" "%TEMP%"\CheckV.TXT') DO (
SET ACCESS=%%I
IF /I NOT DEFINED I (SET ACCESS=NO)
)
ECHO %ACCESS%
PAUSE
The content of CheckV.TXT is as follows. This file's content is extracted from a web page file (The condition for ACCESS to run: main program ACCESS, DAO ADO and JET and their versions):
Jet4.0
DAO3.60
ADO2.80
ACCESS2003
[ Last edited by HUNRYBECKY on 2006-12-19 at 02:08 AM ]
My code is as follows:
@ECHO OFF
FOR /F %%I IN ('FINDSTR /I "ACCESS" "%TEMP%"\CheckV.TXT') DO (
SET ACCESS=%%I
IF /I NOT DEFINED I (SET ACCESS=NO)
)
ECHO %ACCESS%
PAUSE
The content of CheckV.TXT is as follows. This file's content is extracted from a web page file (The condition for ACCESS to run: main program ACCESS, DAO ADO and JET and their versions):
Jet4.0
DAO3.60
ADO2.80
ACCESS2003
[ Last edited by HUNRYBECKY on 2006-12-19 at 02:08 AM ]
