在 C# 中执行我的文件的应用程序

发布于 2024-08-05 19:54:11 字数 141 浏览 0 评论 0原文

我的应用程序创建带有“.mhm”扩展名的文件。

我希望我的应用程序在双击这些文件时打开并处理它们。当前的行为是,当我双击该文件时,我的应用程序会打开但不会处理该文件。

如何读取 C# 2008 中 Main() 方法的 args 参数?

My application creates files with a ".mhm" extension.

I'd like for my application to open and process these files when I double-click them. Current behavior is that when I double-click the file, my application opens but does not process the file.

How can I read the args parameter of Main() method in C# 2008?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冰雪之触 2024-08-12 19:54:11

“嗨,

我的应用程序创建带有 .MHM 文件扩展名的文件。
我希望我的应用程序与此文件扩展名相关联,这样当执行 MHM 文件时,我的应用程序也是如此,文件路径作为我的应用程序主要方法的参数。”

这就是我的理解。Grzenio

有正确的想法 -

public void static Main(string args[])
{ 
...
}

但将您的应用程序推送到 shell 中需要额外的研究,您必须考虑将您的应用程序集成到 Shell 中(使用注册表)

。 /questions/212906/script-to-associate-an-extension-to-a-program#212921">脚本将-extension-to-program关联

编辑: 感谢克里斯对问题的编辑,试图在这里看到更广泛的东西......也许参数解决方案就是 OP 所需的全部。

"Hi

My Application creates files with the .MHM file extension.
I would like my application to be associated with this file extension so that when a MHM file is executed, my application is too, with the file path as the arguments for the main method of my application."

That's what I understood.

Grzenio has the right idea -

public void static Main(string args[])
{ 
...
}

but to push your application into the shell would take extra research, you'd have to look into integrating your application into the Shell (using the registry).

See here: script-to-associate-an-extension-to-a-program

EDIT: Thanks for the edit of the question Chris, trying to see things a bit wider here... Perhaps the arguments solution was all the OP needed.

简美 2024-08-12 19:54:11

如果我正确理解你的问题,你只需使用:

public void static Main(string args[])
{
...
}

If I understand your question correctly you just use:

public void static Main(string args[])
{
...
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文