Update automated_rammap.bat

This commit is contained in:
2026-09-16 17:23:09 +00:00
parent 0f9a67d903
commit 2ec9944a73
+18 -1
View File
@@ -1,3 +1,8 @@
:: USAGE
:: DOWNLOAD SCRIPT
:: RIGHT CLICK AND RUN AS ADMIN ON USER'S MACHINE
:: THIS WILL AUTOMATICALLY RUN RAMMAP, AND THEN CREATE A SCHEDULED TASK TO DO THE SAME EVERY HALF AN HOUR
@echo off @echo off
color 0A color 0A
@@ -8,6 +13,7 @@ echo installing rammap automated cleanup...
set INSTALLDIR=C:\ProgramData\RAMMap set INSTALLDIR=C:\ProgramData\RAMMap
set RAMMAP=%INSTALLDIR%\RAMMap64.exe set RAMMAP=%INSTALLDIR%\RAMMap64.exe
set SCRIPT=%INSTALLDIR%\automated_rammap.bat set SCRIPT=%INSTALLDIR%\automated_rammap.bat
set LOGFILE=%INSTALLDIR%\RAMMap.log
:: create rammap directory :: create rammap directory
mkdir "%INSTALLDIR%" mkdir "%INSTALLDIR%"
@@ -18,19 +24,27 @@ curl -L -o "%TEMP%\RAMMap.zip" https://download.sysinternals.com/files/RAMMap.zi
:: extract rammap :: extract rammap
echo extracting... echo extracting...
::powershell -command "Expand-Archive -Force '%TEMP%\RAMMap.zip' '%INSTALLDIR%'"
tar -xvf "%TEMP%\RAMMap.zip" -C "%INSTALLDIR%" tar -xvf "%TEMP%\RAMMap.zip" -C "%INSTALLDIR%"
:: accept eula
echo accept the EULA...
"%RAMMAP%" -EulaAccepted
:: create automated cleanup script batch file :: create automated cleanup script batch file
echo creating automated cleanup script... echo creating automated cleanup script...
( (
echo @echo off echo @echo off
echo set RAMMAP=%RAMMAP% echo set RAMMAP=%RAMMAP%
echo set LOGFILE=%LOGFILE%
echo echo %%time%% %%date%% starting RAMMap cleanup ^>^> "%LOGFILE%"
echo %RAMMAP% -accepteula -Ew echo %RAMMAP% -accepteula -Ew
echo %RAMMAP% -accepteula -Es echo %RAMMAP% -accepteula -Es
echo %RAMMAP% -accepteula -Em echo %RAMMAP% -accepteula -Em
echo %RAMMAP% -accepteula -Et echo %RAMMAP% -accepteula -Et
echo %RAMMAP% -accepteula -E0 echo %RAMMAP% -accepteula -E0
echo echo Finished RAMMap cleanup at %%time%% %%date%% ^>^> "%LOGFILE%"
echo exit /b 0 echo exit /b 0
) > "%SCRIPT%" ) > "%SCRIPT%"
@@ -41,12 +55,15 @@ schtasks /create ^
/tn "RAMMap Automated Cleanup" ^ /tn "RAMMap Automated Cleanup" ^
/tr "%SCRIPT%" ^ /tr "%SCRIPT%" ^
/sc minute ^ /sc minute ^
/mo 30 ^ /mo 1 ^
/ru SYSTEM /ru SYSTEM
:: cleanup rammap zip file :: cleanup rammap zip file
del "%TEMP%\RAMMap.zip" del "%TEMP%\RAMMap.zip"
:: run task manually (so you do not have to wait half an hour to see the effect)
schtasks /run /tn "RAMMap Automated Cleanup"
echo . echo .
echo rammap cleanup deployed successfully echo rammap cleanup deployed successfully
echo this has created a scheduled task which runs rammap every 30 minutes as system echo this has created a scheduled task which runs rammap every 30 minutes as system