I was trying to do some operations to every file in a folder.
for %%d in (*.txt) do call:test "%%d"
pause
exit /B
:test
echo %1
Usually this works fine, but if there is a file %~aaa.txt in the folder, it says that The following usage of the path operator in batch-parameter substitution is invalid: %~aaa.txt.
How to make it handle this correctly? Maybe some unescaping?