I have a batch script that I created which works fine on Windows XP but faults on Windows 7.

The script basically finds out what the OS is.

wmic os get | find "Windows XP">nul
if %ERRORLEVEL% == 0 goto winxp

wmic os get | find "Windows 7”>nul
if %ERRORLEVEL% == 0 goto win7

Thing is, this works fine on Windows XP but not on Windows 7. Windows 7 throws the following error:

FIND: Parameter format not correct

So my question is, was the find utility changed?

link|improve this question

I hope you copy-pasted this. – William Jackson Nov 17 '11 at 18:16
Of course. I am testing out the solution mentioned below now. – qroberts Nov 17 '11 at 18:32
feedback

1 Answer

up vote 2 down vote accepted

I think it is the funny looking double quote.

wmic os get | find "Windows XP">nul if %ERRORLEVEL% == 0 goto winxp

::SMART QUOTES FTL

wmic os get | find "Windows 7”>nul if %ERRORLEVEL% == 0 goto win7

link|improve this answer
This was the issue. Thanks! – qroberts Nov 17 '11 at 18:35
Yup, smart quotes FTL. Curiously, I have yet to find a text editor that will highlight such errors in batchfiles. Even the Powershell ISE doesn't directly correct or highlight such errors. All you'll notice is that strings are colored red. – surfasb Nov 17 '11 at 19:26
I use Notepad++ as my batch IDE. – qroberts Nov 18 '11 at 14:48
Yeah, that would be my pick too. I could of sworn there are plugins or scripts that will run right before a save. I gotta google for that one. – surfasb Nov 18 '11 at 23:55
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.