Skip to content

Instantly share code, notes, and snippets.

@xv
Last active October 17, 2020 11:56
Show Gist options
  • Save xv/6674946019d8e908e8a66c1c4606ba52 to your computer and use it in GitHub Desktop.
Save xv/6674946019d8e908e8a66c1c4606ba52 to your computer and use it in GitHub Desktop.
Tiny script to enbale/disable the "Low Disk Space" warning.
@echo off
rem Run this script as administrator
rem You may need to restart your computer to take effect
set hKey=HKLM
for /f "tokens=2 delims==." %%a in ('wmic os get version /value') do (
if %%a neq 10 set hKey=HKCU
)
set "regPath=%hKey%\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer"
:lblRegistryActions
cls
echo Select an action by pressing the corresponding number on your keyboard:
echo.
reg query %regPath% /v NoLowDiskSpaceChecks >nul 2>&1
if %errorlevel% neq 0 (
rem Value doesn't exist. We need to add it
reg add "%regPath%" /v NoLowDiskSpaceChecks /t REG_DWORD /d 0 >nul 2>&1
)
for /f "tokens=3" %%a in ('reg query %regPath% /v NoLowDiskSpaceChecks ^| find /i "REG_"') do (
set ldwState=%%a
)
if %ldwState% equ 0 (
echo 1^) Disable "Low Disk Space" warning notification
set ldwState=1
) else (
echo 1^) Enable "Low Disk Space" warning notification
set ldwState=0
)
echo 2) Exit
echo.
choice /C 12 /N /M "-> "
if errorlevel 2 exit /b
if errorlevel 1 (
reg add %regPath% /v NoLowDiskSpaceChecks /t REG_DWORD /d "%ldwState%" /f >nul 2>&1
goto lblRegistryActions
)
pause > nul
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment