find command no longer works on my win 7 machine

th3louvre

New member
Local time
7:54 PM
Messages
1
We have a script that installs an application on a user's box. It can run on XP, Vista, Win 7.... So it uses the ver command and find to figure out what the os is. It used to run on my win 7 box. It no longer does. The find command now gets an error. I tried substituting findstr and it returns a good completion code regardless! The grep command works great but most machines don't have grep so that is not an option to use. I would just like to figure out why find doesn't work. The date for find.exe in the System32 folder says 7/13/2009. Is there something I can do to restore find? Listed below is the the command & output that helps determine the OS version using find/findstr/grep

C:\Users\pwilliams>ver
Microsoft Windows [Version 6.1.7601]
C:\Users\pwilliams>ver|find "Version" <-- this used to work!!
find: `Version': No such file or directory
C:\Users\pwilliams>echo %ERRORLEVEL%
1

C:\Users\pwilliams>ver|findstr "Version"
Microsoft Windows [Version 6.1.7601]
C:\Users\pwilliams>echo %ERRORLEVEL%
0

C:\Users\pwilliams>ver|findstr "Version 6.0" <-----
Microsoft Windows [Version 6.1.7601] |
C:\Users\pwilliams>echo ERRORLEVEL% |--one should fail!
0 |
C:\Users\pwilliams>ver|findstr "Version 6.1" <-----
Microsoft Windows [Version 6.1.7601]
C:\Users\pwilliams>echo %ERRORLEVEL%
0


C:\Users\pwilliams>ver| grep "Version 6.1"
Microsoft Windows [Version 6.1.7601]
C:\Users\pwilliams>echo %ERRORLEVEL%
0
C:\Users\pwilliams>ver |grep "Version 6.0"
C:\Users\pwilliams>echo %ERRORLEVEL%
1
 

My Computer My Computer

At a glance

win 7 professional, 32bit on 64 bit hardwareIntel Core i5
Computer Manufacturer/Model Number
HP Compaq 8100 Elite CMT PC
OS
win 7 professional, 32bit on 64 bit hardware
CPU
Intel Core i5
findstr is not failing because it uses regular expressions to find strings (unless you specify otherwise) so it's not literally interpreting the string you're inputting. In order for it to interpret the string literally, you'd want to use the following:

findstr /C:"Version 6.1"
 

My Computer My Computer

At a glance

XP / Win7 x64 ProIntel Quad-Core Q9450 @ 3.2GHz2x2GB GSkill DDR2NVIDIA GeForce 8600 GTS (EVGA)
OS
XP / Win7 x64 Pro
CPU
Intel Quad-Core Q9450 @ 3.2GHz
Motherboard
Asus P5-E
Memory
2x2GB GSkill DDR2
Graphics Card(s)
NVIDIA GeForce 8600 GTS (EVGA)
Monitor(s) Displays
Dell 2408WFP
Screen Resolution
1920x1200
Back
Top