Open kosherplay-betatester opened 3 weeks ago
I also looked into a downloader or quicklauncher without staying on the system for the sysinternal tools in winutil once.
I did not yet do any try to implement it. I'd like to know what other contributers or Chris think about this Idea tho.
after you unzip sysinternals to %WINDIR% and run RAMMap64.exe -Ew it will emditietly initiate Empty Working Set and you are ready for gaming or working whatever
this code does it all automatically, checks if it already in %windir% if not it download and unpack the zip from microsoft into win dir , then execute RAMMap64.exe -Ew and also adds a nice ready to go Shortcut on the screen to run "RAMMap64.exe -Ew" on and instant
i'd be happy to see this addon to next winUtil version
As far as my research goes for the -ew flag id say if you restart the system, it will effectively clear the working set and free up memory, just like using the RAMMap64.exe -Ew command. Upon restarting, all processes and their associated memory allocations are reset, which includes clearing out the working set.
Having the option to download sysinternal tools is nice I'd say, but I don't see the benefit of having this function of the tool run for example as tweak in the utility.
If I did not get something correct I'd be happy if you could clarify or inform me :)
Every PC has 16 or 32 GB these days.
A reboot to clear the ram is done a few seconds.
Does the wonderful winutil really needs it?
https://github.com/kosherplay-betatester/Clear-RAM-Now open source
Clear Ram Now (super script to auto install and RAMMap64.exe -Ew command with and auto added icon on the desktop
.bat version @echo off :: BatchGotAdmin :------------------------------------- REM --> Check for Administrator privileges by attempting to access a system-protected file. REM If the user doesn't have admin rights, the script will try to elevate itself using UAC.
REM --> If the error level is not 0, it means the user does not have administrator rights. if '%errorlevel%' NEQ '0' ( echo =========================================================================== echo This script requires administrative privileges to run. echo Please press any key to request elevation. echo =========================================================================== pause echo Requesting administrative privileges... goto UACPrompt ) else ( goto gotAdmin )
:UACPrompt REM Create a temporary VBScript to elevate the script using UAC. REM The VBScript runs the same batch file with elevated privileges.
:gotAdmin REM The script now runs with admin privileges, so we can proceed with the rest of the operations. pushd "%CD%" REM Save the current directory. CD /D "%~dp0" REM Change the directory to the script's location.
:--------------------------------------
REM Define variables for paths and file names used in the script.
set "RAMMAP_PATH=%windir%\RAMMap64.exe" REM Path to the RAMMap executable in the Windows directory. set "SHORTCUT_NAME=Clear RAM Now.lnk" REM Name of the desktop shortcut that will be created. set "DESKTOP_PATH=%USERPROFILE%\Desktop" REM Path to the current user's desktop. set "SHORTCUT_PATH=%DESKTOP_PATH%\%SHORTCUT_NAME%" REM Full path for the desktop shortcut.
REM Check if RAMMap64.exe already exists in the Windows directory.
if exist "%RAMMAP_PATH%" ( echo RAMMap64.exe already exists. ) else ( REM If RAMMap64.exe does not exist, download and install it.
)
REM Check if the desktop shortcut already exists.
if exist "%SHORTCUT_PATH%" ( REM If the shortcut already exists, no need to create it again. echo Shortcut 'Clear RAM Now' already exists on Desktop. ) else ( REM If the shortcut doesn't exist, create it.
)
REM Now, run RAMMap64.exe with the -Ew argument to clear Empty Working Sets and free up memory.
echo Running RAMMap64.exe -Ew to clear Empty Working Sets... "%RAMMAP_PATH%" -Ew
REM If the command runs successfully, display a success message. echo Memory has been cleared successfully.
REM Pause to allow the user to see the result before the script closes. pause
##################################################################################
.Ps1 version
#####################
Check for Administrator privileges
This block checks if the script is running with administrator rights. If not, it exits with a warning.
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)) { Write-Warning "This script needs to be run as Administrator." exit }
Set strict error handling to stop execution on any errors
$ErrorActionPreference = 'Stop'
Define the path to RAMMap64.exe in the Windows directory
This variable holds the path where RAMMap64.exe will be installed or where it should already be located.
$rammapExe = Join-Path $env:windir "RAMMap64.exe"
Define the desktop shortcut path
This defines the name and location of the shortcut that will be created on the user's desktop.
$shortcutName = "Clear RAM Now.lnk" $desktopPath = [Environment]::GetFolderPath("Desktop") # Get the user's Desktop path $shortcutPath = Join-Path $desktopPath $shortcutName
Check if RAMMap64.exe already exists
if (Test-Path $rammapExe) {
RAMMap64.exe exists, so we don't need to download it
} else {
If RAMMap64.exe doesn't exist, download and install it
}