A batch file alone can't detect if the file association is correct, but you could just fire the batch file everytime anyway, forcing the file association to be correct. It'll just overwrite what's already there.
Just create the proper associations yourself, then run Regedit and export a .reg file containing the association keys, and use a batch file that runs regedit to import the keys. Probably /import or somesuch - I rarely use Windows anymore!
您可以使用 Powershell 脚本。您将获得 .NET(一种非常好的脚本语言)的强大功能,并且可以使用 vbscripts 和 bat 文件有效地执行任何操作。你们还有一个非常充满活力的社区。而且Powershell使得注册表操作变得如此简单和直观,以至于你不会知道操作文件和操作注册表项之间的区别
You can use Powershell scripts. You get the power of .NET, a very good scripting language and you can effectively do anything you can with vbscripts and bat files. You also have a very vibrant community. And Powershell makes operating with registry so easy and intuitive that you will not know the difference between operating on files and operating on registry items
发布评论
评论(2)
单独的批处理文件无法检测文件关联是否正确,但您可以每次都触发批处理文件,强制文件关联正确。它只会覆盖已经存在的内容。
只需自己创建正确的关联,然后运行 Regedit 并导出包含关联键的 .reg 文件,并使用运行 regedit 的批处理文件来导入键。可能是 /import 或类似的东西 - 我很少再使用 Windows 了!
这是一个解释它的页面:
http://www.robvanderwoude.com/regedit.php
A batch file alone can't detect if the file association is correct, but you could just fire the batch file everytime anyway, forcing the file association to be correct. It'll just overwrite what's already there.
Just create the proper associations yourself, then run Regedit and export a .reg file containing the association keys, and use a batch file that runs regedit to import the keys. Probably /import or somesuch - I rarely use Windows anymore!
Here's a page that explains it:
http://www.robvanderwoude.com/regedit.php
您可以使用 Powershell 脚本。您将获得 .NET(一种非常好的脚本语言)的强大功能,并且可以使用 vbscripts 和 bat 文件有效地执行任何操作。你们还有一个非常充满活力的社区。而且Powershell使得注册表操作变得如此简单和直观,以至于你不会知道操作文件和操作注册表项之间的区别
You can use Powershell scripts. You get the power of .NET, a very good scripting language and you can effectively do anything you can with vbscripts and bat files. You also have a very vibrant community. And Powershell makes operating with registry so easy and intuitive that you will not know the difference between operating on files and operating on registry items