The tag has no usage guidance.

learn more… | top users | synonyms

1
vote
1answer
14 views

Windows XCOPY results from FIND command

Windows 7 CMD I can retrieve a list of files by the following command dir /b | find "TENDER_NUM 2". I'm trying to copy all the files that were returned by find into another folder. I've tried: for /...
0
votes
0answers
29 views

Pipe loop's output into variable, than check with if else

I have the following batch script: @ECHO OFF SET "TLD=.com" FOR /F "tokens=*" %%i in (%cd%\files\domains-win.txt) do ( whoiscl -r -n %%i%TLD% | FINDSTR /I /C:"Registrant Name" > NUL 2>&...
1
vote
1answer
39 views

Batch: Return the matching lines from pipe's output to the console with regex

I have the following domain checking bash script in Linux: #!/bin/bash TLD='.com' while read -r domain; do whois -H $domain$TLD | grep -oPaq '^.*(Creation Date|record created).*$' if [ $? -eq 0 ...
3
votes
1answer
27 views

How to go through a list of installed programs and take out any line with Microsoft-related strings?

This is on Windows 7 using command line and batch files. I was looking to examine my program list and uninstall a good amount of junk and update a good amount of outdated programs. I used a wmic ...
1
vote
1answer
183 views

How do I extract the IPv4 IP Address from the output of ipconfig

I'm attempting to have cmd copy only a specific set of character from a command output. I've been able to select the line that the phrase exists in but from there I am lost. Here is my command so far. ...
2
votes
1answer
131 views

How to use FINDSTR to search in a specific line?

I have a file example.txt and a string "Hi" and the beginning of the 15th line. The required code for findstr should be: findstr /b /n "Hi" "example.txt" Is there something that can search for "Hi"...
0
votes
0answers
60 views

Find “mystring” in files and return only certain portion of matching lines

I have below command to list out every file in current directory and it's sub-directories containing "mystring" along with the line where search string match is found. @echo off setlocal findstr /s ...
0
votes
1answer
35 views

Findstr: match filenames containing exactly a single dot

I am desparately trying to find all files within a folder and its subdirectories containing exactly a single dot. Reading the documentation of findstr I came up with this kind-of-regex, but it still ...
0
votes
1answer
23 views

find certain item of a file by using command line tool in windows 7

recently I used findstr "ItemThatIsBeeingSearchedFor" C:\Windows\System32\drivers\etc\hosts > J:\documents\HostsFile\ResultOfSearch.txt in order to output a certain entry of the hosts file into ...
2
votes
1answer
246 views

Get URL from HTML file using FindStr

I'd like to preface this by saying that I'm very new to the command prompt and I've been only using it for some WGET and YOUTUBE-DL, and that I'm on a Windows 8 PC. I'd like to get a bunch of links ...
0
votes
0answers
69 views

Most efficient command to search the first line of many files (windows)

I am new to the windows ecosystem. I have been tasked with writing a program that will search several 10's (maybe even 100's) of thousands of files for a particular string. The string that must be ...
2
votes
1answer
138 views

Delete scheduled taskname containing space

I want to delete scheduled tasks that start with "Adobe Acrobat" eg "Adobe Acrobat 123","Adobe Acrobat 456","Adobe Acrobat 789" schtasks /Delete /TN Adobe* /F This command fails to find any tasks ...
0
votes
1answer
42 views

Use findstr to output characters 1-13

I have the code: findstr /B ^121.*.CATDrawing catdrawing.txt How to show from the first to thirteenth character? 1220112000001A.CATDrawing -> 1220112000001
0
votes
2answers
307 views

Windows 7 cmd Findstr for 2 strings a AND b(not OR)

I want to know if there is a way to use findstr to find only those lines in a text file which have both strings a and b. The following: findstr "aaa bbb" test.txt will find all lines with aaa or bbb. ...
0
votes
1answer
214 views

Batch to retrieve TFS version erroring in FOR /F where TFS attempts to PIPE to findstr

I have this partial batch, but it gives me an error (On 64 bit installations) SETLOCAL EnableDelayedExpansion REM Figure out what ProgramFiles Root we run the command SET ProgFiles86Root=%...
0
votes
2answers
158 views

Getting value from file using Windows Batch scripting

Using Windows Batch scripting, I want to get the max_volume value (-2.9 in the following example) from a ffmpeg output written to a log file: [Parsed_volumedetect_0 @ 0000000005428b20] n_samples: ...
1
vote
1answer
107 views

What is the difference between regular and literal expressions in FINDSTR?

What is the difference between /R and /C? FINDSTR [options] [/F:file] [/C:string] [/G:file] [/D:DirList] [/A:color] [/OFF[LINE]] [string(s)] [pathname(s)] /C:string Use string as a literal ...
0
votes
1answer
4k views

Script to Find Certain words and delete those lines in a file

EDITED THE QUESTION as i am open to different type of solutions unlike just batch previously I am on Windows & some suggested SED etc. So i am OK with these 3rd party standalone exe's using ...
2
votes
3answers
1k views

In windows, is there a way to count the amount of times a string appears in a file

I am currently trying to write a batch script and at this point, I need to find a string, "null", and determine how many times it is shown in the file. I'm downloading an API from a website every-...
1
vote
1answer
486 views

Dir and Findstr commands taking a long time to complete in Batch File

dir %DRIVE_NAME%: /S /C /A-D /Q /T:C | findstr ".zip$ .doc$ .xls$ .xpt$ .cpt$ .cpo$ .xlsx$ .pdf$ .dat$ .txt$ .docx$ .csv$" >> file.info I am using above command to list all information in file,...
2
votes
2answers
3k views

Use Batch findstr for files with whitespaces

I'm trying to search for a string in a given file. This file can have whitespaces in its name and I'm having trouble with the Batch file. I can easily do this by console getting the correct results: ...
5
votes
1answer
610 views

Vim: How do you use external grep on windows to search for quotation marks?

For some reason I can't for the life of me figure out how to pass single quotation marks to external tools when using vim. For example, I might want to call Vim's external grep to search for the text ...
1
vote
1answer
209 views

Batch : extract some characters of a string

How can I extract alphanumeric characters only from a string? Example : b:lbalbqsd1287/;:!, gives blbalbqsd1287 Is it possible with findstr?
0
votes
1answer
1k views

Searching a string in a file anywhere on PC using Findstr

I have a text (.txt) file located somewhere on my PC that contains a bunch of data, including the following string: Secret Username: ********* Secret Password: ********* How can I find this file ...
1
vote
2answers
3k views

Why does this 'findstr' command not function as expected?

I use the command-line program 'findstr' frequently as I write software. It helps me quickly locate all the files that contain a specific string in a set of subdirectories. It is a lot faster to use ...
0
votes
3answers
553 views

Recursive Batch File

I have a file that looks this: head1,head2,head3,head4,head5,head6 a11,a12,keyA,a14,a15,a16 a21,a22,keyB,a24,a25 a31,a32,keyC,a34 a41,a42,keyB,a44,a44 a51,a52,keyA,a54,a55,a56 a61,a62,keyA,a64,a65,...
1
vote
0answers
834 views

Find vs Findstr results

Per this answer I was attempting to use findstr to locate a string (a name) inside some HL7 log files in a directory. Findstr was getting 0 results, but Find returned plenty. I played around with ...
0
votes
1answer
7k views

How to get the exact match of a string in file using FIND or FINDSTR in dos

I am trying to get the exact match of a path ("\Users\sachin.a.goyal\Desktop\test\") which is there in a file: Biggest.txt: 1 number: name = DMS 3.0 R2 - Deployment Workbook_APAC v4_WMT size = ...
16
votes
4answers
30k views

What's the difference between the find and findstr commands in Windows?

In Windows, what are the differences between the find and findstr commands? Both seem to search for text in files: find C:\> find /? Searches for a text string in a file or files. FIND [/V] [/C]...