Kamil Wiśniewski
Kamil Wiśniewski

Reputation: 131

Special characters in dir command cmd not working

The command dir ??p*p??.dll gives me output like this:

Real output

I would expect it to return all files where the 3rd letter from the start and the 3rd letter from the end are a p.

Any ideas?

Upvotes: 1

Views: 614

Answers (1)

user6811411
user6811411

Reputation:

As AlexK correctly states the wildcard character ? matches the end or .

To have a correct result in cmd filter with (by default regex based) findstr.

In a RegEx the . is similar to ? and .* (any number of dots) to wildcard *
^ anchors at begin, $ achors at the end. A literal dot has to be escaped \.

> dir /B "C:\windows\system32\??p*p??.dll" |findstr "^..p.*p..\.dll$
Apphlpdm.dll
AppointmentApis.dll
mfperfhelper.dll
SrpUxNativeSnapIn.dll

Upvotes: 2

Related Questions