ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Windows: Finding Files with PowerShell

    IT Discussion
    windows powershell sam windows administration get-childitem
    1
    1
    1.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by

      When working from the command line in Windows, we often need to find files but doing so can be less than intuitive. The command that we need is the Get-ChildItem command. To be generally useful, we need to use this command with recursion so that it digs into the filesystem. Without recursion it would only find a file in a single folder which we could normally do simply by listing out the folder.

      Here is the standard syntax:

      Get-ChildItem -Path C:\MyFolder\MySubFolder -Filter MyFile.txt -Recurse
      

      We will normally use all three path, filter and recurse options in any normal file search. As with most of PowerShell, there are a huge number of options and optional approaches to using this command. This is one of the most straightforward and obvious forms.

      1 Reply Last reply Reply Quote 2
      • 1 / 1
      • First post
        Last post