Results 1 to 4 of 4

Thread: Windows PowerShell Select-String

  1. #1
    Join Date
    Feb 2009
    Posts
    61

    Windows PowerShell Select-String

    I want to use Windows PowerShell Select-String. I need a brief idea on that. As network administrator I want to learn the select string command of powershell. How it works and how to script the command to make a application run. As I am using a multiple scripting application but as what i heard about powershell i am quiet interested.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Windows PowerShell Select-String

    Windows PowerShell is a user friendly scripting language. Well be best benefit of this language that even a beginner can easily learn and interact with ther server. All server administrator who wanted a command line shell for scripting will enjoy PowerShell. Some of its feature are. It begins with familiar old dos commands like dir, cd or Ipcofig. You can create log of Cmdlets. It works with your old OS and scripting command. The main part of powershell command is verb noun pair. You get started with powershell with following basic five examples. Run the powershell window and give the below commands :
    • get-command
    • get-command get*
    • get-Eventlog system
    • get-Eventlog system -newest 100
    • get-Eventlog system -newest 100 | where {$_.eventid -eq 20}

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Windows PowerShell Select-String

    Before practicing any example I had given below create a working folder in your drive. Like C:\examples\rock.txt. We will work out with this folder for all the strings. Now in the folder the rock.txt is a notepad file which we will use for scripting. The word inside it is rules. Now follow the example.
    Type the below command in PowerShell command line.
    Code:
    select-string -pattern "Rules" -path "C:\examples\rock.txt"

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Windows PowerShell Select-String

    I had use the below solution to run the select string feature. I think by looking at it you will get an general idea about it. There are multiple examples and solution available over the internet. Just look at the below script.
    Now by using select-string to look for a batch file i.e *.* See the below script.
    Code:
    # PowerShell cmdlet to find the pattern sam.  Note wildcard *
    select-string -pattern "sam"  -path "c:\powershell\files\*.*"

Similar Threads

  1. Run Windows Powershell from Java
    By Jaganmohini in forum Software Development
    Replies: 6
    Last Post: 11-08-2010, 05:08 PM
  2. Windows Vista Powershell
    By DeMario in forum Software Development
    Replies: 3
    Last Post: 14-11-2009, 09:34 PM
  3. What is Windows PowerShell
    By Antonio1 in forum Windows Software
    Replies: 3
    Last Post: 12-11-2009, 06:30 PM
  4. Windows Powershell Training
    By OBAMA in forum Education Career and Job Discussions
    Replies: 3
    Last Post: 26-06-2009, 06:57 PM
  5. How get full line of text from select-string
    By Cabexas in forum Software Development
    Replies: 3
    Last Post: 02-06-2009, 01:59 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,870,504.45567 seconds with 17 queries