有些人认为Desktop.ini文件是病毒或恶意软件,因为它有时会突然出现在他们的 PC 上。幸运的是,情况并非如此,但如果您想知道Windows的Desktop.ini文件是什么,那么您来对地方了。
在本文中,我们将介绍Desktop.ini文件是什么、如何使用它以及是否可以安全删除。
什么是 Desktop.ini 文件?
Desktop.ini 文件是Microsoft Windows(包括Vista和Windows 10/11)上每个文件夹中的隐藏配置文件。(hidden configuration file)每个Desktop.ini文件都包含该文件夹的配置设置。
Desktop.ini文件默认不可见,因为它是受保护的操作系统文件。如果它突然出现在您的 PC 上,则您或其他用户已更改您的文件夹设置以显示隐藏文件夹。
Desktop.ini文件是在对文件夹进行特定更改时创建的,例如为其提供自定义图标或特定共享设置。
如何查看 Desktop.ini 文件?
Desktop.ini文件被隐藏并受到保护,因此普通用户永远不会遇到它们。要使它们在您的文件夹中可见:
- 打开文件资源管理器(File Explorer)。
- 选择查看(View )选项卡。
- 选择选项(Options)。
- 选择查看(View )选项卡。
- 向下滚动并选中显示隐藏的文件、文件夹和驱动器(Show hidden files, folders, and drives)。
- 进一步向下滚动并取消选中隐藏受保护的操作系统文件(推荐)(Hide protected operating system files (Recommended))。选择是(Yes )接受警告消息。
Desktop.ini文件现在应该出现在您已更改其配置或布局的任何文件夹中 。
我可以删除 Desktop.ini 文件吗?
删除Desktop.ini文件只会将文件夹恢复为其默认设置。所以是的,您可以删除Desktop.ini文件。但是,如果您想保留对文件夹设置所做的更改,您可以通过反转我们在上一节中向您展示的步骤来隐藏Desktop.ini文件。(Desktop.ini)
如何使用Desktop.ini 文件自定义文件夹(Desktop.ini File)
使用Desktop.ini(Desktop.ini)文件自定义Windows文件夹很简单。首先(First),您需要隐藏该文件夹(hide the folder)并将其标记为重要的系统文件夹,以便 Windows 授予它所需的只读属性,以启用Desktop.ini文件中的特殊行为。
为此:
- 打开(Open)或创建您要自定义的文件夹。
- 打开开始菜单,然后键入命令提示符(Command Prompt )并选择它。
- 在命令提示符中,键入attrib +s “FolderName”。例如:attrib +s “C:\Test\TestFolder”并按Enter。
接下来,您需要创建和编辑Desktop.ini文件。为此,您需要在要自定义的文件夹中创建一个文本文件。
- 在文件夹窗口的顶部,确保打开文件扩展名(File name extensions )。
- 右键单击您的文件夹并选择New > Text Document。
- 将其命名为Desktop.ini并按Enter。将出现一个消息框,要求您检查文件扩展名。单击(Click) 是(Yes)。
- 右键单击您刚刚创建的文件并选择Properties。在Attributes(Attributes,)旁边,勾选Hidden和Read-only。
- 按确定(OK)。
- 双击文件以在(Double-click)记事本(Notepad)中打开它。单击(Click) 文件(File )>另存为(Save As)。
- 要获取某些短语/格式,文件需要以Unicode保存。在窗口底部,通过Encoding确保选择了UTF-8。
现在可以使用配置设置填充Desktop.ini文件。(Desktop.ini)以下是一些可用于自定义文件夹的设置:
- [.ShellClassInfo]:这允许您使用以下条目自定义文件夹的视图。
- ConfirmFileOp:如果设置为“0”,则在删除或移动文件夹时不会收到警告。
- NoSharing:将此设置为“1”表示该文件夹不能共享。
- IconFile:用于指定自定义文件夹图标(custom folder icon)或缩略图。要使用此条目,您需要指定图标的路径。首选 .ico 格式,但它也接受.bmp和.dll文件。
- IconResource:与IconFile类似,用于指定图标的路径。从文件夹的属性中手动选择图标时,它会出现而不是IconFile 。
- IconIndex:要指定自定义图标,还需要存在此条目。如果包含您的图标的文件夹只有一个图标,您可以将其设置为 0。
- 信息提示:(InfoTip: )此条目将信息文本字符串添加到文件夹,以便将光标悬停在该文件夹上时,将出现一个文本框。
例如,这是我使用自定义图标和InfoTip创建的测试文件夹:
这是用于自定义它 的Desktop.ini文件:(Desktop.ini)
就是这样,伙计们
现在您知道了Desktop.ini文件是什么以及如何使用它来添加自定义文件夹选项。虽然它对大多数用户来说并不是特别有用,但知道一个神秘的隐藏文件夹并不是逃避您的防病毒软件的恶意软件总是很高兴的。
What Is the Windows Desktop.ini File and Can I Delete It?
Some people assume the Desktop.ini file is a virus or malware because іt sometimes appears suddenlу on their PC. Luckily, this isn’t the case, but if yoυ’re wondering what Windows’ Desktop.іni file is, yоu’ve come to the right place.
In this article, we’ll cover what the Desktop.ini file is, how you can use it, and whether it’s safe to delete.
What Is the Desktop.ini File?
The Desktop.ini file is a hidden configuration file found in every folder on Microsoft Windows (including Vista and Windows 10/11). Each Desktop.ini file contains the configuration settings for that folder.
The Desktop.ini file is not visible by default as it’s a protected operating system file. If it’s suddenly appearing on your PC, you or another user have changed your folder settings to display hidden folders.
Desktop.ini files are created when specific changes are made to a folder, such as giving it a custom icon or specific sharing settings.
How Can I See the Desktop.ini File?
Desktop.ini files are hidden and protected, so the average user will never encounter them. To make them visible in your folder:
- Open File Explorer.
- Select the View tab.
- Select Options.
- Select the View tab.
- Scroll down and check Show hidden files, folders, and drives.
- Scroll down further and uncheck Hide protected operating system files (Recommended). Select Yes to accept the warning message.
The Desktop.ini file should now appear in any folder where you have altered its configuration or layout.
Can I Delete the Desktop.ini File?
Deleting the Desktop.ini file simply reverts a folder to its default settings. So yes, you can delete the Desktop.ini file. However, if you want to keep the changes you’ve made to a folder’s settings, you can simply hide the Desktop.ini file by reversing the steps we showed you in the previous section.
How to Customize a Folder With the Desktop.ini File
Customizing a Windows folder with the Desktop.ini file is simple. First, you need to hide the folder and label it as an important system folder so that Windows grants it the required read-only attribute that enables special behavior from the Desktop.ini file.
To do so:
- Open or create the folder you would like to customize.
- Open the Start menu, then type Command Prompt and select it.
- In Command Prompt, type attrib +s “FolderName”. For example: attrib +s “C:\Test\TestFolder” and hit Enter.
Next, you need to create and edit the Desktop.ini file. To do so, you need to create a text file in the folder you would like to customize.
- At the top of the folder window, ensure that File name extensions are turned on.
- Right-click in your folder and select New > Text Document.
- Name it Desktop.ini and press Enter. A message box will appear asking you to check the file extension. Click Yes.
- Right-click the file you’ve just created and select Properties. Next to Attributes, tick Hidden and Read-only.
- Press OK.
- Double-click the file to open it in Notepad. Click File > Save As.
- For certain phrases/formatting to be picked up, the file needs to be saved in Unicode. At the bottom of the window, by Encoding, ensure that UTF-8 is selected.
The Desktop.ini file is now ready to be populated with configuration settings. Here are some of the following settings you can use to customize your folder:
- [.ShellClassInfo]: This allows you to customize the folder’s view with the following entries.
- ConfirmFileOp: If this is set to “0”, you will not receive the warning when deleting or moving the folder.
- NoSharing: Setting this to “1” means that this folder cannot be shared.
- IconFile: Used to specify a custom folder icon or thumbnail image. To use this entry, you need to specify the path for the icon. The .ico format is preferred, but it will accept .bmp and .dll files too.
- IconResource: Similar to IconFile, this is used to specify the path for the icon. It appears instead of IconFile when manually selecting the icon from the folder’s properties.
- IconIndex: To specify a custom icon, this entry also needs to be present. If the folder containing your icon only has one icon, you can set it to 0.
- InfoTip: This entry adds an informational text string to the folder so that when hovering your cursor over it, a text box will appear.
For example, here’s a test folder I created with a custom icon and InfoTip:
And here’s the Desktop.ini file used to customize it:
That’s All, Folks
Now you know what the Desktop.ini file is and how you can use it to add custom folder options. While it isn’t particularly useful for most users, it’s always good to know that a mysterious hidden folder isn’t malware evading your antivirus.