使用vb.net创建文件关联 [英] Creating a file association with vb.net
问题描述
我正在vb.net中创建一个程序,我想将我的应用程序设置为给定文件扩展名的默认应用程序,例如.txt
.
我该怎么做?
我找到了一种通过vb.net关联文件的简单方法(来自CodeProject,链接: I am creating a program in vb.net, and I want to set my application as the default application for a given file extension - for example, How can I accomplish this? I found a simple way to associate files by vb.net (from CodeProject, link: http://www.codeproject.com/Articles/18594/File-Association-in-VB-NET) The code is:
这篇关于使用vb.net创建文件关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!.txt
.My.Computer.Registry.ClassesRoot.CreateSubKey(".rtf").SetValue("", "Rich Text File", Microsoft.Win32.RegistryValueKind.String)
My.Computer.Registry.ClassesRoot.CreateSubKey("Rich Text File\shell\open\command").SetValue("", Application.ExecutablePath & " ""%l"" ", Microsoft.Win32.RegistryValueKind.String)