Returns a unique nonexistent full path file name based on the name passed in. Usage: uniqfile ex: uniqfile filename.ext -> \filename.ext | -> \filename.1.ext | ... -> \filename.2.ext | ... ex: uniqfile %tmp%\mylogfile.log -> c:\tmp\mylogfile.log | -> c:\tmp\mylogfile.1.log | ... Typical call sequence from a CMD script: set script_name=%~n0 ... for /f %%i in ('uniqfile %tmp%\%script_name%.log') do set logfile=%%i call logmsg.cmd /t "Start %cmdline%" NOTE: We write to the file, so other uniqfile calls will see it. Otherwise, multiple uniqfile calls will return the same unique file name.