Acho que esta linha está inacabada:
if not goto createLog
Eu simplifiquei um pouco e usei timeout
em vez de sleep
:
@echo off
set "CURRENT_DIR=C:\Documents and Settings\Administrator\My Documents\Downloads\"
if not exist "%CURRENT_DIR%\log.txt" (
echo Creating log.txt
echo >"%CURRENT_DIR%\log.txt"
) else (
echo Log file exists. Appending data.
)
:writeLog
tasklist >> "%CURRENT_DIR%\log.txt"
timeout /t 3 > nul
goto writeLog