Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@ECHO OFF
SETLOCAL
ECHO ASLR Enable / Diable Batch Script - Please run as admin
set /p Choice=Want to Enable or Disable ASLR? (e or d):%=%
if "%Choice%"=="e" goto :ENABLE
if "%Choice%"=="d" goto :DISABLE
:ENABLE
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "MoveImages" /t REG_DWORD /d 1 /f
goto :EOF
:DISABLE
reg delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "MoveImages"
goto :EOF
@glnzglnz

This comment has been minimized.

Copy link

commented Jul 4, 2019

Will this work in Win 7 Pro 64-bit, which does not even have the key "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" ?

@trietptm

This comment has been minimized.

Copy link
Owner Author

commented Aug 23, 2019

@glnzglnz It exists on Windows 10, so it should exists on Windows 7 ;) .

@xambroz

This comment has been minimized.

Copy link

commented Sep 9, 2019

I believe the default is to have ASLR enabled so deleting the key will most probably enable ASLR. To disable you need to explicitly set the value to 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.