使用C#更改文件夹的图标 [英] Change icon of folder using C#

查看:126
本文介绍了使用C#更改文件夹的图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

美好时光

我有超过1000个电影文件夹,我想更改任何基于desktop.ini的电影的文件夹图标。

例如,我有很多电影通过以下方式。

F:\电影\

如何在C#中完成。

1.在每个文件夹中创建一个desktop.ini文件。

2.每个desktop.ini文件的内容如下。



[.ShellClassInfo]

IconResource = *。ico,0



3.在短语IconResource前面=只有.ico扩展名的文件名。



例如:



[.ShellClassInfo ]

IconResource = Stranger Things.ico,0



请提供想法和源代码....



感谢



我尝试过:



我为文件夹编写的代码量。该文件夹中的可执行文件创建desktop.ini文件并将其放在两行中。我不知道其余的步骤。我该怎么办?



[.ShellClassInfo]

IconResource =



Hello
Good time
I have more than 1000 movie folders and I want to change the folder icon for any movie based on desktop.ini.
For example, I have a lot of films in the following way.
F:\Movies\
How can I do it in C#.
1. Create a desktop.ini file in each folder.
2. The contents of each desktop.ini file are as follows.

[.ShellClassInfo]
IconResource=*.ico,0

3. In front of the phrase IconResource = Only the file name that has the .ico extension.

for example:

[.ShellClassInfo]
IconResource=Stranger Things.ico,0

please give the idea and source code....

Thank

What I have tried:

The amount of code I've written for a folder. The executable file in the folder creates the desktop.ini file and places it in two lines. And I do not know the rest of the steps. What should I do?

[.ShellClassInfo]
IconResource=

private void button1_Click(object sender, EventArgs e)
        {
            TextWriter tw = new StreamWriter("desktop.ini");
            tw.WriteLine("[.ShellClassInfo]");
            tw.WriteLine("IconResource=" );
            tw.Close();
            
        }

推荐答案

参见更改系统文件夹图标,C# [ ^ ]


这篇关于使用C#更改文件夹的图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆