9

I have an administrator account on a Windows 7 x64 machine. It is not THE administrator account, the account is simply a member of the administrators group.

The install is default. When the user opens a command prompt it ends up in the users' %HOMEPATH% directory where you'll find various directories like the Documents folder. If the user uses the following (windows) FIND command, an "Access Denied" error occurs:

FIND /I "My String" C:\Users\Rann\Documents
Access denied - C:\USERS\RANN\DOCUMENTS

Using runas or right-clicking on the command prompt to run it as an administrator does not change this behaviour; an administrator-level cmd.exe still gives me the same error. Changing the path to any other directory gives the same error.

My question is thus: How is one supposed to use the FIND (and possibly other) commands? What rights are needed?

closed as off-topic by Sven May 12 '18 at 13:28

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on Server Fault must be about managing information technology systems in a business environment. Home and end-user computing questions may be asked on Super User, and questions about development, testing and development tools may be asked on Stack Overflow." – Sven
If this question can be reworded to fit the rules in the help center, please edit the question.

12

You are trying to execute find on a directory. It only works on files. Try this:

FIND /I "My String" C:\Users\Rann\Documents\*
  • Right! So you have to know beforehand in what folder the file or files are located to successfully use the Find command to find the text string you are looking for. It doesn't understand recursion. It lost that ability somewhere, somehow, along the way, during "development". For this reason, you might as well cd into the directory where the file is and issue find /i "my string" * which would search all the files in that folder for "my string". – Samir Jun 8 '15 at 14:01
3

This is not right. FIND used to search all subdirectories, but no longer 'can' because of Win 7's security. You have to mount the filesystem OFFLINE to properly use FIND.

  • You can add Windows Vista to the list of Windows versions that no longer have a Find command that understands recursion. I am running Vista Ultimate, x64 at the moment and I am seeing the same problem. – Samir Jun 8 '15 at 14:08
  • 2
    maybe, use findstr instead – aeroson Aug 25 '17 at 14:04
  • @aeroson: That is the answer - Are you going to post it? – Pieter Geerkens Nov 13 '17 at 14:58
  • @PieterGeerkens I know it worked for me, but don't know why, feel free to post it. – aeroson Nov 14 '17 at 23:01
3

That is true, it seems that Find no longer recurses down anymore. But hey, no worries, we can use a little scripting help here. Here is one that I tried and it works:

for /R %G in (*) do (find "String_I_am_Looking_For" %G)

This will search all the sub-folders.

This may produce several lines of output. So it may be easier to direct the output to a file:

for /R %G in (*) do (find "String_I_am_Looking_For" %G) >> output.txt

And then look for the search string in this file (you can use visual inspection or Ctrl+F for find here).

  • A little awkward to locate the actual matches amongst all the junk that the 'find' command outputs, but this does the trick for the odd search! – John Rix Mar 18 '14 at 11:49
  • 1
    I have edited the command to send the output to a text file - perhaps it is easier this way to use the output that is produced. – shivesh suman Dec 30 '14 at 6:06
-2

This is Babar Here ,I charge fees on this but it is now free for sake of Reps.

Let me tell you How would you bypass the Access Denied File or Folder via cmd :

Objective : You must know the Name of Folder and Drive in which you want to access into .

If you apply this : Lets say your Folder is in Drive-D and the Name is babar.

C:\users\system32> cd /d d: press enter

D:>for %g in (babar) do (find /n /i "Folder Name:" "%g" ) press enter

D:> ACCESS DENIED -File Not found

::#######################################

This will happen if you try this above command in CMD.EXE

Now Watch how will I make you to bypass the ACCESS DENIED error file .

C:\users\system32> cd /d d:

D:>for /r %g in (babar) do (find /n /i "Folder Name: %g ") press enter

D:>(find /n /i "Folder Name: D:\babar ")

and press "ctrl C buttons" to cancel and come out of CMD shell

I hope this will be enough to understand how many sites do not show mistakes during explanation of content.

Thank You.