Automatically reset desktop

When using Windows, I always end up with a messy desktop. Temporary files, useless shortcuts, small notes, an "OldIcons" folder ...

What I would like is a way for my desktop to reset itself every day. The icons that really have to be there should be there, but all the other junk can be removed.

It's relatively easy to do in Windows, without third party software.

Solution

The goal is to use the "Public Desktop" as the template of what the desktop should look like. Everything on the personal desktop is removed at log on.

In Windows, your desktop shows the icons from the Public Desktop C:\Users\Public\Desktop, and from your user C:\Users\user\Desktop.

So all you have to do is clear C:\Users\user\Desktop at startup.

Step 1: The script

Make sure the directory C:\Users\Default\Desktop exists and is empty.

Create a file clearDesktop.cmd:

@echo off
robocopy "C:\Users\Default\Desktop" "C:\Users\user\Desktop" /Z /E /MIR

For some reason, clearing all files and folders from a folder is complicated. As seen in this stackoverflow question.

It's easy using robocopy, but you need an empty folder first. You then mirror that empty folder to the folder for which you want to remove the content.

Additionally, you could add some files to the "Default" desktop folder. That way they are also added to the user desktop.

Step 2: Create The Scheduled Task

You can make the script run at system startup.

In windows, go to "Start" and type "Task Scheduler". Start the Task Scheduler.

Add a new task, with:

  • Trigger: At system startup
  • Action: "Start a program"
  • And pass the full path of the clearDesktop.cmd script.

Test

First run the script, and make sure you're pointing to the correct folders! See your files dissapear from the desktop.

Now put a new file on your desktop and reboot. The file should be gone now.

Conclusion

I always make weird scripts to do the thing I want. I always forget how I did it, so I wrote it down here.

That's my conclusion.

Another conclusion could be: you don't need to download third party tools for everything.