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…
EDIT- I DID find the answer.. Complete user error..
At some point, the COMSPEC environment variable path got changed, and so was WRONG!!!! With a typo!!! :/ So lame.
While comparing env variables between my new environment and old, I finally noticed the typo. Man, one character cost me hours and hours. I didn’t realize before ( though its obvious now ) that was the path used for the bat command or I would have given it more scruteny. Not sure why it worked at all (???)
================
Well, I am not happy with the fix- because it was a BIG hammer. But I installed a new Windows 7 VM, and now I can run the script.
Earlier In stalled a newer version of the vm- 3.1.4 ( the newest free upgrade from my 3.1.2 ) and that did not solve the problem.
And before that I tried the things suggested above ( Many thanks to the people who posted above! )
Not sure what is screwed up with my windows install, but it’s something.. I’ve compared against other computers, and my environment args all look good. Java is good, etc. Just something about either my user account on that VM, or …? Not sure. Ran out of time, had to move on. 🙂
If I figure it out I will post the answer. In the mean time I’ll be setting up and hopefully working from this new VM.
cheers!
Dustin