Skip to content

Instantly share code, notes, and snippets.

@PSingletary
Last active February 10, 2021 11:02
Show Gist options
  • Save PSingletary/8ebbea58c634539655efdeeca1c7a342 to your computer and use it in GitHub Desktop.
Save PSingletary/8ebbea58c634539655efdeeca1c7a342 to your computer and use it in GitHub Desktop.
What's running? Nevermind, I don't care. KILL ALL USER PROCESSES!!!!!

Sometimes you feel like you need a reboot, but don't want to lose minutes shutting down and starting back up. Both of these files do the same thing.

  • Finds all the things running the the context of the current accunt logged/running
  • Stops them

Need this? Here's how to setup

  1. Level 1 comfort - umm this is scary
    1. Click the Download .zip button in upper right
    2. Open Downloads folder
    3. Unzip to desktop
    4. Doubleclick the stop-userprocesses.bat
  2. Level 2 - I know what a script is!
    1. Same as Level 1
  3. Level 3 - #/-(|<[-/2
    1. you didn't even read this
@echo off
cd c:\windows\System32
for /f "skip=3 tokens=1" %%i in ('TASKLIST /FI "USERNAME eq %userdomain%\%username%" /FI "STATUS eq running"') do (
if not "%%i"=="svchost.exe" (
if not "%%i"=="explorer.exe" (
if not "%%i"=="cmd.exe" (
if not "%%i"=="tasklist.exe" (
taskkill /f /im "%%i"
)
)
)
)
)
Get-Process | Where-Object { $_.SessionId -eq ([System.Diagnostics.Process]::GetCurrentProcess().SessionId) } | Stop-Process -Force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment