Skip to content

Instantly share code, notes, and snippets.

@stuartwakefield
Last active December 15, 2015 03:39
Show Gist options
  • Save stuartwakefield/5195691 to your computer and use it in GitHub Desktop.
Save stuartwakefield/5195691 to your computer and use it in GitHub Desktop.
Starting to log processes for my Win PC
:: Put this somewhere sensible open up the Task Scheduler create a new
:: task to run this batch file on a regular interval
@echo off
set DIRPATH=%~dp0
:: Create a timestamp for the file
set TS=%date:~-4,4%%date:~-7,2%%date:~-10,2%-%time:~0,2%%time:~3,2%%time:~6,2%-%time:~9,2%
:: Create the log directory if it doesn't exist
if not exist %DIRPATH%log (
mkdir %DIRPATH%log
)
:: List processes to file
call wmic process list > %DIRPATH%log/process-%TS%.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment