我正在创建一个文本编辑器,并且正在尝试编写代码以获取使用打开方式"在应用程序中打开文件时的文件路径.
I'm making a text editor and I'm trying to make a code to get the file path of a file when it's open in a application using 'Open With'.
详细信息:右键单击文件时,打开方式"是一个选项.该文件然后成为该应用程序的快捷方式.我尝试使用Process,但似乎无法从文件进程中获取路径.
Details: 'Open With' is an option when you right click on a file. The file then becomes a shortcut to the application. I have tried to use Process , but I couldn't seem to get the path from a file process.
问题:在c#中,使用打开方式"时如何获取文件的文件路径?
Question: In c#, how do you get the file path of a file when using 'Open With'?
编辑: 应用程序路径为C:\ Users \ Mayhem \ Documents
EDIT: Application path is C:\Users\Mayhem\Documents
文本文件路径为C:\ Users \ Mayhem \ Desktop
Text file path is C:\Users\Mayhem\Desktop
我需要获取文本文件"的文件路径.
I need to get the file path of 'text file'.
推荐答案
我的目标是使用打开方式"获取文件的路径. 这段代码显示了应用程序打开的所有路径,包括文件路径.
My goal is to get the path of a file using 'Open With'. This code shows all paths opened with the application, including the file path.
string[] openedPaths = Environment.GetCommandLineArgs();更多推荐
c#如何从“打开方式"获取文件路径?
发布评论