Announcement

Collapse
No announcement yet.

Find two or more strings in an output

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Find two or more strings in an output

    Hi

    In the command prompt in Windows 8.x, the output of the dir command produces a list of all files and directories with their information.

    If I wanted to display only the output of only two or three files (including their information), how should I do?

    Note: These files, that I should see, have completely different names.

    Thanks

    Bye
    balubeto

  • #2
    Re: Find two or more strings in an output

    This would be easier with powershell. Not knowing exactly what you're wanting to get, you could do something like this:

    Code:
    #Enter the 3 files you want to search for below
    $file1 = 'name of file 1'
    $file2 = 'name of file 2'
    $file3 = 'name of file 3'
    
    #Enter the name of the directory you want to search between 
    #the single quotes below where "C:\" is.
    $rootdir = 'C:\' 
    
    Get-ChildItem $rootdir -Recurse | Where-Object {$_.name -eq $file1 -or $_.name -eq $file2 -or $_.name -eq $file3}
    Regards,
    Jeremy

    Network Consultant/Engineer
    Baltimore - Washington area and beyond
    www.gma-cpa.com

    Comment

    Working...
    X