Wednesday, May 16, 2012

Error with bat file token or for loop: not recognized as an internal or external command, operable program or batch file

Need Windows .bat file tech support.
I am having trouble running Win 7 bat files which loop through tokens and variables. The script below works on my wifes PC, and should on all PCs, but does not on mine.



** I am running Windows 7 in VMWare off my Mac.



The file is located at the root of c:



This short little script, and any others like it with tokens gives me errors ( I copied the script below out of the .bat file ):



setLocal ENABLEDELAYEDEXPANSION
set SCHEMA_one= first
set SCHEMA_two= second
set SCHEMA_three= third

@ECHO ON
FOR /F "tokens=2* delims=_=" %%A IN ('set SCHEMA_') DO (
echo "looping through " %%A
)
endLocal


I get the following error:



C:\>FOR /F "tokens=2* delims=_=" %A IN ('set SCHEMA_') DO (echo "looping through " %A ) 'set SCHEMA_' is not recognized as an internal or external command, operable program or batch file.


Ideas???



Many thanks in advance. I have been stuck for hours and hours...





No comments:

Post a Comment