4

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).

1
  • Then you have to manually calculate the UsePreferenceMask registry and put the value in reg add command. For window animation the bit place is 1 and value 0 disables it.
    – Biswapriyo
    Sep 2, 2017 at 17:07

1 Answer 1

8

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.

3
  • Will this all work without admin rights? Sep 2, 2017 at 18:44
  • @InterLinked Yes, I believe it does.
    – Ben N
    Sep 2, 2017 at 19:02
  • This is great - works like a charm and very quick! I'm a fan of PowerShell myself but usually rely on batch files for things like this. I guess there are some things batch can't do! Sep 2, 2017 at 23:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .