从 Process.Start 自动运行 CD
使用 Process.Start 和 ProcessStartInfo 模拟自动运行 CD(我猜是其他媒体)的最接近的方法是什么?
我尝试过一些明显的事情,例如:
// Just opens the folder
Process.Start("F:");
// Ditto
Process.Start(new ProcessStartInfo("F:") {UseShellExecute = true});
// Throws System.ComponentModel.Win32Exception: No application is associated with the specified file for this operation
Process.Start(new ProcessStartInfo("F:") {UseShellExecute = true, Verb = "autorun"});
我显然可以解析 autorun.inf 文件来计算出涉及的可执行文件,但我只是想知道是否有更简单的方法来做到这一点。
What is the closest way to emulate autorunning a CD (or other media, I guess) using Process.Start
and ProcessStartInfo
?
I've tried obvious things like:
// Just opens the folder
Process.Start("F:");
// Ditto
Process.Start(new ProcessStartInfo("F:") {UseShellExecute = true});
// Throws System.ComponentModel.Win32Exception: No application is associated with the specified file for this operation
Process.Start(new ProcessStartInfo("F:") {UseShellExecute = true, Verb = "autorun"});
I can obviously parse the autorun.inf
file to work out the executable involved, but I'm just wondering if there's a simpler way to do it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
[检查文件是否存在]
编辑:抱歉,自动运行似乎是资源管理器的功能。 您必须自己解析该文件。
[Check if the file exists]
EDIT: Sorry, autorun seems to be an Explorer feature. You will have to parse the file yourself.