Quantcast
Channel: Active questions tagged windows - Super User
Viewing all articles
Browse latest Browse all 9162

Create a batch file to execute tasklist and append its output to log.txt

$
0
0

I'm trying to create a batch file to execute tasklist every 3 minutes and log it into log.txt. I'm very new to batch files and would like to know where I've gone wrong in my batch file.

@echo offset "CURRENT_DIR=C:\Documents and Settings\Administrator\My Documents\Downloads\":checkLogif exist "%CURRENT_DIR%\log.txt" goto writeLogecho Log file exists. Appending data.if not goto createLog:createLogecho Creating log.txtecho   >"%CURRENT_DIR%\log.txt":writeLogtasklist >> "%CURRENT_DIR%\log.txt"goto loop:loopsleep 3 goto writeLog

Viewing all articles
Browse latest Browse all 9162

Trending Articles