find command no longer works on my win 7 machine


  1. Posts : 1
    win 7 professional, 32bit on 64 bit hardware
       #1

    find command no longer works on my win 7 machine


    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


  2. Posts : 1,814
    XP / Win7 x64 Pro
       #2

    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


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 22:55.
Find Us