findstr command

Ko kim 1 Reputation point
2022-05-24T05:07:08.057+00:00

Hi,
I'm sorry for the poor English.

I am creating a batch that outputs the lock status of a specific folder with the "opnefies command" and "findstr command".

Since the folder contains a yen mark, please tell me how to search for the yen mark as a character string.

openfiles /query /v |findstr /R "C:\Program" NG
openfiles /query /v |findstr /R "C://Program" NG
openfiles /query /v |findstr /L "C:\Program" NG
openfiles /query /v |findstr /C:"C:\Program" NG
openfiles /query /v |findstr /R "C:/Program" NG

Thanks.

Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2022-06-01T04:52:18.317+00:00

    Hi,

    The findstr command does not work with the non-ASCII characters. You can try PowerShell instead.

    powershell.exe -NoProfile -Executionpolicy Bypass -command "openfiles /query /v | Where-Object {$_ -match 'C:¥Program'}"  
    

    Best Regards,
    Ian Xue

    -----------------------------

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.