Page 1 of 1

Unable to rename over UNC path.

Posted: 2023-09-04 10:56:20
by rs232
I have a renaming script that I call via context menu on my windows device. This for many years helped me renaming folders placed in a remote (samba) share.
After upgrading my system from windows 10 to windows 11, I noticed that the renaming over UNC path doesn't work any more.
If I copy over the folder locally to C: everything works as expected. Renaming files manually in the UNC path works as well so I'm a bit puzzled as this seems to be an application thing.

This is my directory_rename.arb

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<AntRenamer Version="2.12.0" Date="03/08/2023">
 <Batch>
  <ChangeCase Option="3" AfterChars="(" UseLocale="0" IncludeExt="0" OnlyExt="0"/>
  <StrRepl Search="." Repl=" " AllOccurences="-1" CaseSensitive="0" IncludeExt="0" OnlyExt="0"/>
  <ChangeCase Option="1" AfterChars="(" UseLocale="0" IncludeExt="0" OnlyExt="0"/>
  <Regexp Expr="(.+)((19|20)[0-9]{2}).(.*)" Repl="$1[$2]"/>
  <ChangeCase Option="0" AfterChars="(" UseLocale="-1" IncludeExt="0" OnlyExt="0"/>
  <StrRepl Search="[[" Repl="[" AllOccurences="-1" CaseSensitive="-1" IncludeExt="0" OnlyExt="0"/>
  <StrRepl Search="([" Repl="[" AllOccurences="-1" CaseSensitive="-1" IncludeExt="0" OnlyExt="0"/>
 </Batch>
</AntRenamer>
And this the context_menu.reg

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\AntRename]
@="Ant rename me~"

[HKEY_CLASSES_ROOT\Folder\shell\AntRename\command]
@="C:\\Program Files (x86)\\Ant Renamer\\renamer.exe  -b c:\\directory_rename.arb -aF %1 -g -x"
Although I suspect there's nothing wrong with these (they used to work just fine in windows 10). Perhaps a silly/unwanted Windows 11 "security feature"? Perhaps the context menu call needs to be modified in windows 11 to better support UNC?

Thanks

Re: Unable to rename over UNC path.

Posted: 2023-09-06 12:45:13
by antp
Unfortunately I don't have a Windows 11 to test.
One thing to check, in your .reg the folder received as parameter is maybe not enclosed in quotes.
I don't know if Windows adds them or not.
You may want to try to replace %1 by "%1", so maybe ""%1"" as this is already between quotes?
(or edit it via regexit and export it to check the right syntax)

Re: Unable to rename over UNC path.

Posted: 2023-09-07 12:47:38
by rs232
Indeed that helped! The only correction is a slash quotation instead of double quotation so this I can confirm works as expected:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\AntRename]
@="Ant rename me~"

[HKEY_CLASSES_ROOT\Folder\shell\AntRename\command]
@="C:\\Program Files (x86)\\Ant Renamer\\renamer.exe -b C:\\directory_rename.arb -aF \"%1\" -g -x"
Thanks