Windows 7 Batch: Find /i

随声附和 提交于 2019-12-08 07:58:01

问题


I have a windows batch file in Windows 7 which does something with find.

it starts with this:

find /i /c....

But it says something like

find /i is no medium

or so. Then it just gives a list of every single file in the C:\ directory.

Is there any new replacement for Windows 7?

EDIT: If i hit find /? in cmd, it gives find: /? there is no such file or directory


回答1:


You probably have the posix find command installed on your computer. Type:

where find.exe

To locate it. You probably can change the path environment variable on your system so the system32 directory will be first.

You could obtain something like the following :

> where find.exe
C:\Program Files (x86)\Git\bin\find.exe
C:\Windows\System32\find.exe

In the above example, the first find executable is from Git system, in consequence commands like find /I ... (MS original) don't work anymore.

Update: First try to run the command with full path:

c:\windows\system32\find.exe /i "foo"

And see what happens.

Then compare the file to the same file in other windows 7 installation ( I don't have one right now). You can also look at the file property. Is it from microsoft?




回答2:


It appears from your example you're not encasing your search with quotes. Find on its own or with /? will give you the command line options. Find /i "SearchString" "MyFile" means search Myfile for SearchString but ignore case.



来源:https://stackoverflow.com/questions/1657872/windows-7-batch-find-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!