Disable creation of desktop.ini in windows 10 (on the Desktop)

25

2

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.

Neil Townsend

Posted 2015-11-28T08:29:32.627

Reputation: 449

Does UseDesktopIniCache=0 (from the reply at http://superuser.com/a/650431/523828) not work in Windows 10?

– dxiv – 2015-11-28T19:09:21.340

@dxiv Afraid it doesn't work. – Neil Townsend – 2015-11-29T08:52:47.453

I assume you made/verified the change under both Software and Software\Wow6432Node, and that you rebooted after. – dxiv – 2015-11-29T17:07:46.810

@dxiv Yes ... afraid I have ... – Neil Townsend – 2015-11-29T21:16:29.330

Thanks for the followup. One less thing to try when my "10" time comes. – dxiv – 2015-11-29T21:24:33.810

Answers

7

(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

tlex

Posted 2015-11-28T08:29:32.627

Reputation: 71

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 – 2016-10-02T17:57:17.340

2Hi, afraid this doesn't work on my windows 10 system, running latest version of 10. But thanks for trying, appreciate it. – Neil Townsend – 2016-10-26T10:31:41.953

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.

Spero

Posted 2015-11-28T08:29:32.627

Reputation: 111

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 – 2018-01-31T10:09:18.107

-1

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

Thor

Posted 2015-11-28T08:29:32.627

Reputation: 1

Afraid this doesn't work, sorry. – Neil Townsend – 2016-03-10T07:11:41.340

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 – 2016-03-15T03:20:35.557

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. – Neil Townsend – 2016-03-15T07:46:49.737

Understood, thanks for checking and sorry it didn't work. – Thor – 2016-03-16T20:21:02.463

-2

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.

potatoman

Posted 2015-11-28T08:29:32.627

Reputation: 121

4I 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? – Neil Townsend – 2015-11-28T11:06:49.960

1The 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 – 2015-11-28T11:41:27.467

4While 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 – 2015-11-28T18:41:47.793

Did some more research, no ill affects, but it's best to leave it alone. – potatoman – 2017-01-10T01:27:18.230

-3

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

GollyRojer

Posted 2015-11-28T08:29:32.627

Reputation: 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! – Neil Townsend – 2016-06-08T13:49:52.090

@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 – 2017-04-23T21:19:58.087

TG2, did you even read my post? There's some lack of understanding going on here, but it isn't on my part. – GollyRojer – 2018-03-31T05:23:05.587