// Edit
I really appreciate the comment made by the verdy_p. it's not only relevant but also incredibly enriching. It adds great value to the discussion, and that's why I've decided to include it in the edit. Thanks for sharing such thoughtful input!
Querying the registry directly at specific path for getting the NTFS behavior is not recommended.
You should use FSUTIL behavior query disable8dot3 [volume]
Note that there's a system-wide default setting (the one that the registry query above may return), which can be overriden on specific volumes (in addition FSUTIL works also for non-NTFS filesystems, such as FAT32, ExFAT, ReFS, and possibly even HPFS, NFS, Ext4 or other network filesystems, if the relevant filesystem drivers are installed and if they support such Windows behavior option). – verdy_p
Note Using the FSUTIL command, execution requires admin credentials.
//
You need one for loop to avoid some 3rd file with additional characters after ".tmp" to be deleted too...
for /t tokens^=* %i in ('where .:*.tmp')do echo\ del "%~i"
The where command will return only files .end with .tmp (only)...
You can also try /Recursive:
for /t tokens^=* %i in ('where/r "D:\MyProject\Folder" *.tmp')do echo\ del "%~i"
I can't explain the reason for this event that happened to you, but it happens to me too...
Now I know... @phuclv explained in his answer ... plz, consider his answer
> reg query "HKLM\System\CurrentControlSet\Control\FileSystem" /v "NtfsDisable8dot3NameCreation"
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem
NtfsDisable8dot3NameCreation REG_DWORD 0x0


- Using
For /fwith whereto keep files *.tmp*

I also don't know how to explain why this event doesn't happen with @spikey_richie...