得到打开默认程序的文件的路径? 比如说我们打开一个.txt文件,调用的是notepad.exe这个程序。我想知道这个.txt程序的路径。我现在正在做一个编辑器,我把打开方式的应用程序设为我的编辑器后,然后打开文本文件时,我的编辑器就直接把文件读出来。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 FileInfo fileInfo = 你给的文件信息; fileInfo.FullName //你要的文件全名 楼上的在干吗?我的意思是如何得到.txt文件的路径,我不是用的openfiledialog。当我双击.txt文本文件的时候我的程序自动读取这个文本,但我不知道如何去读取文本的路径。 // 主程序static void Main(string[] args){ // 从args中获取文件信息}// 注册表test.exe %1 这个问题要靠注册表搞定啊那个文件路径是系统传递给你的%SystemRoot%\system32\NOTEPAD.EXE %1需要改Program.cs里的代码 /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } 是不是这样的到文件路 static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //args[0]是不是文件的路径? Application.Run(new Form1()); } 原来每一个args都是一个路径,谢谢了 winform 中在几个区域中选出随机数 c#中怎样动态设置DataGridview的列标题 所有的用户控件为什么放到这个页面就用不了了呢 ? 求助:如何获取access数据库的相对路径 .net控件的问题 c/s程序登陆模块选用WEB SERVICE可以吗? 问个极端傻瓜的问题!! DataGrid每格到显示提示信息,即当鼠标移到一个数据上时显示提示信息。(高分,兄弟们急!!!!!) C#打包程序怎么做更新功能 C#是不是真的跨平台的? 用户控件实现页面的切换 正则表达式求助
fileInfo.FullName //你要的文件全名
我的意思是如何得到.txt文件的路径,我不是用的openfiledialog。
当我双击.txt文本文件的时候我的程序自动读取这个文本,但我不知道如何去读取文本的路径。
static void Main(string[] args){
// 从args中获取文件信息
}// 注册表
test.exe %1
%SystemRoot%\system32\NOTEPAD.EXE %1需要改Program.cs里的代码
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//args[0]是不是文件的路径?
Application.Run(new Form1());
}