Christian Cornelsen
04/09/2025, 10:24 AMSebastian Parelius
04/09/2025, 10:54 AMMarco Zimmermann
04/09/2025, 10:55 AMMarco Zimmermann
04/09/2025, 10:58 AM# Define a C# class for calling WinAPI.
Add-Type -TypeDefinition @'
public class SysParamsInfo {
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, uint pvParam, uint fWinIni);
const int SPI_SETCURSORS = 0x0057;
const int SPIF_UPDATEINIFILE = 0x01;
const int SPIF_SENDCHANGE = 0x02;
public static void CursorHasChanged() {
SystemParametersInfo(SPI_SETCURSORS, 0, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
}
}
'@
# Change the cursor
Set-ItemProperty -Path 'HKCU:\Control Panel\Cursors' -Name 'IBeam' -Value '%SystemRoot%\cursors\beam_r.cur'
# Notify the system about settings change by calling the C# code
[SysParamsInfo]::CursorHasChanged()Matt Sliva
04/09/2025, 1:36 PMSarah Vogt
04/09/2025, 2:58 PMRody Kossen
04/09/2025, 4:45 PMPaul Brown
04/09/2025, 5:28 PMChristian Cornelsen
04/09/2025, 7:13 PM