Questions tagged [findstr]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
2answers
2k views

Windows Batch - Get name of currently logged-in user

In a sort of small mitigation for a large network for the exploit of replacing utilman.exe on windows repair, by cmd.exe, then changing user password, I'm doing a small script based on EventSentry ...
0
votes
0answers
35 views

BAT script to return server licenses at shutdown?

My office uses program licenses that have to be manually activated and returned, and people tend to forget to do this when they go home for the day, resulting in most licenses tending to be ...
2
votes
1answer
264 views

Search strings in text files and show in output the string, preceding one and next one (cmd.exe)

I have a lot of big text files. And I'm searching (within cmd.exe) for a list of values in them as following: findstr /i /n /g:strings.txt 1\*.* >results.txt where strings.txt is the file with ...
1
vote
1answer
1k views

Windows findstr with AND condition?

Is it possible, in one line, without a batch file to use findstr and only return a 0 %errorlevel% if all of the strings are found? I am doing a gem list, which lists out a bunch of gems. I then want ...
0
votes
1answer
106 views

How to remove a line in a file found in multiple directories

There is file that exists in each user profile directory and I need to remove the line from the file in each user profile directory. I'm using a batch script to go through each user profile directory, ...
0
votes
1answer
261 views

Matching Inverse of String in Windows CLI

Can anyone show me a good example of how to match it. Maybe I misread the documentation a bunch of times, but it does not even some close to how real tools like grep ought to work. The output of the ...
2
votes
2answers
15k views

How can I escape double quote character for use in findstr on the PowerShell command line?

This command lines works running in cmd.exe: findstr /l /i /s /c:"key=\"Smtp" *.config However running in PowerShell 2 on Windows 7 Ultimate x64, findstr seems to freeze no matter which combination ...
1
vote
5answers
156 views

Copying a chunk of output in Windows 7

I'm wondering how to copy a chunk of output in the command prompt in Windows 7. What I'm ultimately trying to accomplish is when I type "route print" I want to copy the IPs listed under IPv4 Route ...
11
votes
3answers
13k views

Doing logical OR comparisons with findstr.exe

This may be a stupid question but even after reading the documentation I'm still not sure how to find all lines in a file that contain either ".cpp" or ".h". Is there a way to do that? For example (...