5

I'd like to disable animations in Windows 10, specifically animations for maximizing/minimizing windows. It doesn't look like each key has its own registry setting, and I don't see it in this list of values: https://technet.microsoft.com/en-us/library/cc957204.aspx

Is this possible, or is this something I would have to do manually?

It would be nice if I could disable animations in general, but I'd be happy if I could even just write a script that would disable only the maximize/minimize animations:

enter image description here

Running this solution does not work:

REG ADD "HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics" /v MinAnimate /t REG_SZ /d 0 /f >nul 2>&1

This option requires a logout/login or restart, unlike the manual method which takes effect immediately (preferred).

InterLinked
  • 2,635

2 Answers2

9

You can use PowerShell! We need to invoke SystemParametersInfo with an appropriately configured ANIMATIONINFO structure, since that Windows API function sends the window message that causes the change to take effect immediately. I wrote this script:

Add-Type -TypeDefinition @"
    using System;
    using System.Runtime.InteropServices;
    [StructLayout(LayoutKind.Sequential)] public struct ANIMATIONINFO {
        public uint cbSize;
        public bool iMinAnimate;
    }
    public class PInvoke { 
        [DllImport("user32.dll")] public static extern bool SystemParametersInfoW(uint uiAction, uint uiParam, ref ANIMATIONINFO pvParam, uint fWinIni);
    }
"@
$animInfo = New-Object ANIMATIONINFO
$animInfo.cbSize = 8
$animInfo.iMinAnimate = $args[0]
[PInvoke]::SystemParametersInfoW(0x49, 0, [ref]$animInfo, 3)

The C# part defines the structure and function that we need to call. Then the script creates the animation configuration structure, and finally it calls the function. 0x49 is the code that tells SystemParametersInfo to set the animation setting and the 3 in the last parameter specifies that we want both the user profile to be updated and the setting change notification sent.

To use the script, save it as a .ps1 file, e.g. windowanim.ps1. Follow the instructions in the Enabling Scripts section of the PowerShell tag wiki to allow script execution, then you can run this command from a batch file to disable window animations:

powershell -c .\windowanim.ps1 $false

If you want to enable the animations, supply $true to the script instead.

If the function invocation is successful, you'll see True printed to the console, no matter whether you enabled or disabled animations.

Ben N
  • 42,308
1

Simple one-liner batch script although it requires this SprintDLL tool

sprintdll.exe call user32.dll!SystemParametersInfoW (int 0x49, int 0, blockptr(int 8, int 0), int 3)