Forum Discussion
Show/Hide Desktop Icons with a single click
Late reply, but I found a solution that can be used with a keybind and doesn't require any downloads or installations.
I'm going to assume you know some basics, and won't need step by step.
If you do need step by step, let me know and I will make one.
Create a .ps1 file call it "ToggleShowDesktopIcons.ps1" and edit it to read:
$source = @"
using System;
using System.Runtime.InteropServices;
namespace DesktopUtility
{
class Win32Functions
{
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
[DllImport("user32.dll")]
public static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll")]
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
}
public class Desktop
{
public static IntPtr GetHandle()
{
IntPtr hDesktopWin = Win32Functions.GetDesktopWindow();
IntPtr hProgman = Win32Functions.FindWindow("Progman", "Program Manager");
IntPtr hWorkerW = IntPtr.Zero;
IntPtr hShellViewWin = Win32Functions.FindWindowEx(hProgman, IntPtr.Zero, "SHELLDLL_DefView", "");
if (hShellViewWin == IntPtr.Zero)
{
do
{
hWorkerW = Win32Functions.FindWindowEx(hDesktopWin, hWorkerW, "WorkerW", "");
hShellViewWin = Win32Functions.FindWindowEx(hWorkerW, IntPtr.Zero, "SHELLDLL_DefView", "");
} while (hShellViewWin == IntPtr.Zero && hWorkerW != null);
}
return hShellViewWin;
}
public static void ToggleDesktopIcons()
{
Win32Functions.SendMessage(Desktop.GetHandle(), 0x0111, (IntPtr)0x7402, (IntPtr)0);
}
}
}
"@
Add-Type -TypeDefinition $source
[DesktopUtility.Desktop]::ToggleDesktopIcons()
Code edited by: @Pyro2k6
Save Exit.
Now create a shortcut of the script (Right click> Send to> Create shortcut desktop) and bind a shortcut key
Restart your PC.
The bind you chose should now toggle show/hide desktop icons.
or just run the .ps1 script.
I believe the shotkey bind will only work when the shortcut is on the desktop.
Alternatively:
To hide the shortcut, place it inside:
"C:\Users\"Your Username"\AppData\Roaming\Microsoft\Windows\Start
NolandC - I wonder why Microsoft haven`t added the hide-icons-feature to the presentation mode settings?
There you can turn of the screenprotector, chose another background and chose volume level- when it`s turned on - it should have been an option to hide the icons as well.
How do we reach someone that can fix it as a built in Windows feature?
- red-chocolateApr 19, 2025Copper Contributor
It IS built in: right click the desktop > View > Show desktop icons
- red-chocolateApr 19, 2025Copper Contributor
It IS built in: right click the desktop > View > Show desktop icons