Search code examples
batch-filewildcardfindstr

want to search for asterisk in findstr but character is recognised as wildcard instead


Iv got a simple findstr function (windows batch) however im trying to search for the actual asterisk character in a text document. Because the * character is also used as a wildcrad function my program becomes muddeld up.

Dose any body know how to overcome this issue?

@echo off

SET EXTENT=%~x1
SET MYPATH=%~dp1

SET FILETYPE=%PATH%*%EXTENT%

Type C:\HELLO.txt | findstr /I /V /C:"%FILETYPE%">>C:\TEMP.txt

DEL /S/Q "C:\HELLO.txt"

ren "C:\TEMP.txt" "HELLO.txt"

DEL /s/q "C:\TEMP.txt"

Solution

  • Solution: \*
    Can be found at findstr /?