The official (i.e. non-hacky) way to bypass Windows filename limitations is to use the special CMD prefix \\?\
followed by the absolute (i.e. full) path to the file.
This prefix and the related form \\.\
allow you to bypass use of the Windows API directly, and can also be used in the same way to get around other Windows filename limitations such as maximum length (useful for deleting files whose paths are too long to be deleted normally).
To rename a file to .htaccess, simply run the following in a command prompt:
rename "\\?\B:\Users\Me\Desktop\TEST.txt" ".htaccess"
Note that the full path to the file is necessary - because the \\?\
syntax sidesteps the Windows API itself, it loses the ability to resolve relative path names, so an absolute path is needed for it to know where the file is.