36

I would like to stop the 'desktop.ini' file being created on the 'Desktop' of my windows 10 machine. I have asked this question sepcifically about Windows 10: There is a question about the same issue on Windows 8 here, the solutions proposed there (and elsewhere) for Windows 7 and 8 don't seem to work.

Please, no solutions along the lines of 'disable viewing hidden files'. My specific question is how to stop the file being created on the desktop.

5
  • Does UseDesktopIniCache=0 (from the reply at superuser.com/a/650431/523828) not work in Windows 10?
    – dxiv
    Nov 28, 2015 at 19:09
  • @dxiv Afraid it doesn't work. Nov 29, 2015 at 8:52
  • I assume you made/verified the change under both Software and Software\Wow6432Node, and that you rebooted after.
    – dxiv
    Nov 29, 2015 at 17:07
  • @dxiv Yes ... afraid I have ... Nov 29, 2015 at 21:16
  • Thanks for the followup. One less thing to try when my "10" time comes.
    – dxiv
    Nov 29, 2015 at 21:24

5 Answers 5

8

(Much) Later edit: It appears that this solution doesn't work on Windows10 anymore. Leaving the answer here for reference.


I used the solution found here:

  • Press Win+R and enter regedit
  • Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer
  • Edit / create new DWORD: UseDesktopIniCache with the data 0

For me, I didn't have the value, so I had to create it. After restart, it automatically created the value in HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Policies\Explorer

Running Windows 10 Build 14393.222

2
  • 1
    Please read How to reference material written by others. You should block quote text that has been written by some else. See Markdown help. I've fixed it for you this time, but please pay attention to this in future.
    – DavidPostill
    Oct 2, 2016 at 17:57
  • 2
    Hi, afraid this doesn't work on my windows 10 system, running latest version of 10. But thanks for trying, appreciate it. Oct 26, 2016 at 10:31
-1

*Updated script. Experimental Inheritance safe script. This will not destroy usability of your desktop. Anyone who already lost inheritance run

ICACLS "C:\Users\<username>\Desktop" /reset /t 

to get back full functionality.


It is not possible to prevent Windows from creating desktop.ini because it is not actually Windows that is doing it. Some other third-party service is triggering the creation of that file, and clearly, Windows allows that in spite of UseDesktopIniCache=0.

Desktop.ini was driving me insane so I came up with a ragtag solution. I observed that the desktop.ini file gets created a few seconds after boot. I took advantage of that. Using Task Scheduler, I temporarily disable write permission on Desktop upon boot. That stops third-party services from performing shenanigans with my desktop. Then one minute after boot, another task reinstates write permission on Desktop.

Here I have shared a set of sample XML files for Task Scheduler to do the job.

This one is for disabling write permission on boot:

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2018-01-09T18:21:14.9818893</Date>
    <Author>spero_LAPTOP\spero</Author>
    <URI>\Desktop Write Permission disable</URI>
  </RegistrationInfo>
  <Triggers>
    <LogonTrigger>
      <ExecutionTimeLimit>PT1M</ExecutionTimeLimit>
      <Enabled>true</Enabled>
    </LogonTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>##################################</UserId>
      <LogonType>Password</LogonType>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>false</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>true</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
    <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>PT1M</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>ICACLS</Command>
      <Arguments>"C:\Users\spero\Desktop" /deny "spero":(WD)</Arguments>
    </Exec>
  </Actions>
</Task>

This one is for reinstating the permission a minute later:

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2018-01-09T18:19:03.2968461</Date>
    <Author>spero_LAPTOP\spero</Author>
    <URI>\Desktop Write Permission</URI>
  </RegistrationInfo>
  <Triggers>
    <LogonTrigger>
      <ExecutionTimeLimit>PT1M</ExecutionTimeLimit>
      <Enabled>true</Enabled>
      <Delay>PT1M</Delay>
    </LogonTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>######################################</UserId>
      <LogonType>Password</LogonType>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>false</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>true</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
    <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>PT1M</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>ICACLS</Command>
      <Arguments>"C:\Users\spero\Desktop" /grant "spero":F /r</Arguments>
    </Exec>
  </Actions>
</Task>

Please note that my boot drive is an SSD, albeit not a very fast one. The timings might vary depending on how fast your OS boots.

Also, you can't import these scripts directly because of the presence of Author and User ID fields. You need to manually replace those with proper values. The Author is simply computername\username. The UserId for the currently logged in user can be obtained by opening a Command Prompt and entering wmic useraccount where name='%username%' get sid. The first line of the response will be SID, the next line will look something like X-#-#-##-##########-##########-##########-#### - that's your UserId. And replace "spero" with your username.

You need to save this as an xml file, then import it from Task Scheduler.

3
  • Update: After using the above solution for a bit, and having to deal with a thousand "You don't currently have permission to access this folder" messages which turned out to be a bigger bother than the desktop.ini files, now I recommend changing the command to ICACLS "C:\Users\Spero\Desktop" /deny "Administrators":(WD). I have updated the above script accordingly.
    – Spero
    Jan 31, 2018 at 10:09
  • This is completely incorrect: "because it is not actually Windows that is doing it"
    – NetMage
    Aug 27, 2020 at 21:56
  • @NetMage I would be interested to see if you can reproduce this behaviour in a fresh windows installation. Steps?
    – Spero
    Sep 23, 2020 at 17:27
-2

[Deleted prior answer] Whoops, sorry about that. Its been awhile and had it confused with thumbs.db

Try this instead for desktop.ini files: Open the registry editor and navigate to: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer Change UseDesktopIniCache value to 0 (Add it as a DWORD value if it doesn't already exist.

Here are a couple links to other's posts where it was working for them. Most were with win 7 and 8 however.

4
  • Afraid this doesn't work, sorry. Mar 10, 2016 at 7:11
  • Whoops, sorry about that. It's been awhile and had it confused with thumbs.db I've updated with a resolution that I've tried and is working for me. Give it a try.
    – Thor
    Mar 15, 2016 at 3:20
  • Thanks for trying, but it doesn't work. None of the windows 7/8 methods I've found out there work! I'll make the question clearer. Mar 15, 2016 at 7:46
  • Understood, thanks for checking and sorry it didn't work.
    – Thor
    Mar 16, 2016 at 20:21
-5

It is best not to delete the desktop.ini file, as the folder requires the .ini file to run properly. A Desktop.ini file is a file that determines the way a folder is displayed by Windows. If you do want to however, enable view hidden files and right-click and press delete to delete the item.

5
  • 6
    I have hidden files viewable all the time. I regularly delete this file and everything works just fine. But after a while it is re-created. As per the question, I want to stop it being created. How do I do this? Nov 28, 2015 at 11:06
  • 1
    The answer is correct. Its a system file performing a system function. Windows re-creates it because it knows it should have it. Your solutions are: Hide it. Ignore it. Petition MS to radically change the OS in the next release or stop using Windows.
    – Linef4ult
    Nov 28, 2015 at 11:41
  • 6
    While that's the official line deleting it may cause the folder to be problematic it's also misleading. Can you name one ill effect if deleting desktop.ini?
    – dxiv
    Nov 28, 2015 at 18:41
  • Did some more research, no ill affects, but it's best to leave it alone.
    – potatoman
    Jan 10, 2017 at 1:27
  • If there's no ill effects, then it's NOT best to leave it alone, as leaving it alone DOES have ill effects.
    – TelFiRE
    Sep 13, 2022 at 6:17
-5

I know you said "stop it from being created". I assume that is because you want system files to be visible and desktop.ini (and probably thumbs.db) simply not present. The following solution doesn't stop it from being created, but it hides system files on your desktop only, not system-wide. Perhaps that would be acceptable.

  • Select "Desktop" in Windows Explorer
  • Click the "View" tab
  • Uncheck “Hidden items” under “Show/hide” in the ribbon

I got this solution here: http://searchenterprisedesktop.techtarget.com/blog/Windows-Enterprise-Desktop/Settings-Reset-in-Windows-10-Reinforces-Desktopini-Trick

3
  • 1
    However, despite what the article says, that also stops hidden items from being visible everywhere. It is a system wide switch, at least when I tried it! Jun 8, 2016 at 13:49
  • 1
    @GollyRojer .. down-voted your "answer" because you don't fully understand the issue. All you've proposed is to HIDE something, not actually stop the OS from creating them. Additionally, your suggestion causes issues for those that have taken steps explicitly to show all files. Hiding them, is akin to sweeping a pile of dirt under the carpet. out of view, but the dirt is still there.
    – TG2
    Apr 23, 2017 at 21:19
  • TG2, did you even read my post? There's some lack of understanding going on here, but it isn't on my part.
    – GollyRojer
    Mar 31, 2018 at 5:23

You must log in to answer this question.

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