Now the problem is that sometimes the format of this "Schemes to Sign_for_%VAR001%.doc" vary depend upon the developer and could be
Schemes_to_Sign_for_%VAR001%.doc
Schemes to_Sign_for_%VAR001%.doc
Which wildcard I can use in this case to accommodate all these possible variation of the file name??

If you don't need to access the matched file or know the exact file name, then using wildcard in combination with `IF` statement would suffice, but if there is a need to access the file afterwards (read contents of, know the exact file name, pass the file name to another program,...) then `FOR` statement can do the job of `IF EXIST` and at the same time gives access to the exact match.

If you don't need to access the matched file or know the exact file name, then using wildcard in combination with `IF` statement would suffice, but if there is a need to access the file afterwards (read contents of, know the exact file name, pass the file name to another program,...) then `FOR` statement can do the job of `IF EXIST` and at the same time gives access to the exact match.

for %%f in ("PathToFile\a?b?c.ext") do (
REM being here means that there is at least one existing match and %%f refers to the exact match
)

But you should then watch for multiple matches as the loop will be executed for every one of them

Thanks a lot sst!

I tried it and not working due to I need to access the file afterwards. I shall try the FOR command as you suggested.
However, I also need to use this file in a tiny utility (convert word to txt ) therefore give me the limitation to use this...

If you don't need to access the matched file or know the exact file name, then using wildcard in combination with `IF` statement would suffice, but if there is a need to access the file afterwards (read contents of, know the exact file name, pass the file name to another program,...) then `FOR` statement can do the job of `IF EXIST` and at the same time gives access to the exact match.

So in this way, I can make sure the file format is always has underscore between words, like Schemes_to_Sign_for_%VAR001%.doc
No matter what the format of the source file as these as mightbe
Schemes to_Sign_for_%VAR001%.doc
Schemes to Sign_for_%VAR001%.doc
Schemes_to_Sign_for_%VAR001%.doc
I always can handle the file to be Schemes_to_Sign_for_%VAR001%.doc as the input to the next code....
Thanks anyway...

As I alluded to in my previous comment, you seem to know that you need to use quotes to protect spaces with your full file path within the FOR command so why wouldn't you use quotes with the rename command. Using quotes is a best practice regardless of needing them or not. Pretty sure we have mentioned this to you a couple of times in your previous questions.

As I alluded to in my previous comment, you seem to know that you need to use quotes to protect spaces with your full file path within the FOR command so why wouldn't you use quotes with the rename command. Using quotes is a best practice regardless of needing them or not. Pretty sure we have mentioned this to you a couple of times in your previous questions.