Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 02-06-2009
Member
 
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.
Reply With Quote
  #2  
Old 02-06-2009
Member
 
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}
Reply With Quote
  #3  
Old 02-06-2009
Member
 
Join Date: May 2008
Posts: 2,008
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"
Reply With Quote
  #4  
Old 02-06-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
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\*.*"
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Windows PowerShell Select-String"
Thread Thread Starter Forum Replies Last Post
Run Windows Powershell from Java Jaganmohini Software Development 6 11-08-2010 05:08 PM
Windows Vista Powershell DeMario Software Development 3 14-11-2009 09:34 PM
What is Windows PowerShell Antonio1 Windows Software 3 12-11-2009 06:30 PM
Windows Powershell Training OBAMA Education Career and Job Discussions 3 26-06-2009 06:57 PM
How get full line of text from select-string Cabexas Software Development 3 02-06-2009 01:59 PM


All times are GMT +5.5. The time now is 02:00 AM.