用.......打开时在C#windows应用程序中获取文件路径 [英] Get file path in C# windows application when open with.......

查看:103
本文介绍了用.......打开时在C#windows应用程序中获取文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我正在尝试创建一个从记事本(.txt文件)读取数据并在richedit中显示文本的应用程序。应用程序应该在右键单击记事本(.txt文件)并使用我的应用程序打开时启动。



我的问题是,如何获取所选的路径。通过右键单击.txt文件并使用此应用程序打开应用程序启动应用程序时的txt文件..



帮我修补..

在此先感谢。



问候

Sarath

Hi all,

I am trying to create an application that reads data from a notepad(.txt file) and display the text in a richedit. Application should be started when right clicking on the notepad(.txt file) and open with my application.

My problem is, how to get the path of the selected .txt file when starting the application by right clicking on the .txt file and open with this application..

Help me frnds..
Thanks in advance.

regards
Sarath

推荐答案

它将是Environment.GetCommandLineArgs()调用中的第二个参数,它返回启动程序的命令行参数的字符串数组。



Environment.GetCommandLineArgs()MSDN [ ^ ]
It will be the second argument in the Environment.GetCommandLineArgs() call, which returns a string array of the command line arguments that started the program.

Environment.GetCommandLineArgs() MSDN[^]


这篇关于用.......打开时在C#windows应用程序中获取文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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