Thursday, 15 March 2012

How to use OR operator in findstr command from a windows 7 command prompt? -


The searchstrom is considered to support regular expressions and the way I am using it, let me test it For one or the file ends in ".exe" or ".dll" though I can not get the operation to work or '.' While using Windows, windows think that I am trying to pip the previous command and 'OR' is literally read or

Findstr.exe in the Windows system 32 directory only supports a very limited set of regular expression characters.

But to get the help displayed for this console application running in the prompt prompt window, findstr /? The result is going on,

for example a list file FileNames.lst for example

 in case of multiple search strings on the command line A simple or expression can be specified for the creation. 

C: \ Program Files \ Internet Explorer \ ieproxy.dll C: \ Program Files \ Internet Explorer \ iexplore.exe C: \ Program Files \ Internet Explorer \ iexplore.exe.mui < All file names ending with / pre>

and .dll or .exe should be case-insensitive Findstr command line This output can be output from:

 % SystemRoot% \ system32 \ findstr.exe / I / R "\ .exe $ \ .dll $" FileNames.lst  For example rows in 

output FileNames.lst :

  C: \ program file \ Internet Explorer \ ieproxy.dll C: \ Program Files \ Internet E Xplorer \ iexplore.exe  

The regular expression in the search string is interpreted by the location findstr between a two wires a separator. Therefore, the search searches have regular expression string . Dll $ and . Search with Exe $ and return all the rows where one of the two exchanges matches the string.

For one or two or more regular expression strings a parameter / C: "..." will be used multiple times on the command line, which is necessary when searching a regular expression The string contains 1 or more spaces, which should be included in the search expression as the literal character (s).

 % SystemRoot% \ system32 \ findstr.exe / I / R / C: "\ .dll $" /C:"\.exe$ "FileNames.lst  

The result is similar to the other command line.

But this specific task is not required to run any regular expression search because Searchstric also parameters / E return only those rows Provides where the detected strings meet at the end of the line.

 % SystemRoot% \ system32 \ searchstr.exe / E / I /C:.exe /C:.dll filename. Lst  

No comments:

Post a Comment