Or maybe something like: #include <File.au3> ConsoleWrite(_UniqueFileName(@ScriptDir & "\Filename.txt") & @CRLF) Func _UniqueFileName($_sFilePath) If FileExists($_sFilePath) = 0 Then Return $_sFilePath Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "" Local $aPathSplit = _PathSplit($_sFilePath, $sDrive, $sDir, $sFileName, $sExtension) Local $i = 1 While 1 $_sFilePath = $sDrive & $sDir & $sFi