Skip to content

Instantly share code, notes, and snippets.

@kas-cor
Last active October 17, 2017 07:28
Show Gist options
  • Select an option

  • Save kas-cor/f830b3cb433f0d78f12e9989d655523b to your computer and use it in GitHub Desktop.

Select an option

Save kas-cor/f830b3cb433f0d78f12e9989d655523b to your computer and use it in GitHub Desktop.
Clearing memory
@echo off
echo Memory usage gt 200 MB
tasklist /nh /fi "Session ne 0" /fi "Memusage gt 200000"
echo .
echo Memory usage gt 300 MB
tasklist /nh /fi "Session ne 0" /fi "Memusage gt 300000"
echo .
echo Memory usage gt 400 MB
tasklist /nh /fi "Session ne 0" /fi "Memusage gt 400000"
echo .
echo Memory usage gt 500 MB
tasklist /nh /fi "Session ne 0" /fi "Memusage gt 500000"
echo .
echo 1. Kill all memory usage gt 200 MB
echo 2. Kill all memory usage gt 300 MB
echo 3. Kill all memory usage gt 400 MB
echo 4. Kill all memory usage gt 500 MB
echo 5. Kill PID
set /P choice="Choice: "
if "%choice%"=="1" taskkill /f /fi "Session ne 0" /fi "Memusage gt 200000"
if "%choice%"=="2" taskkill /f /fi "Session ne 0" /fi "Memusage gt 300000"
if "%choice%"=="3" taskkill /f /fi "Session ne 0" /fi "Memusage gt 400000"
if "%choice%"=="4" taskkill /f /fi "Session ne 0" /fi "Memusage gt 500000"
if "%choice%"=="5" GOTO killpid
GOTO exit
:killpid
set /P choice="Enter PID: "
taskkill /f /pid %choice%
:exit
pause
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment