获取处理文件的路径名 [英] get the pathname of a proccesing file

查看:122
本文介绍了获取处理文件的路径名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的程序打开扩展名为.abc的文件
如何打开我的.abc文件时,我的程序将获得其路径名

my program open files with extension .abc
how to make so when i open an .abc file my program will get its pathname

推荐答案

如果您要谈论的是用户双击.ABC的时间归档您的应用程序启动时,有两种方法可以获取命令行参数.

如果在项目属性中启用了Application Framework,则可以在My.Application.CommandLineArgs()中查找文件的标准路径.

如果不是,则必须解析在Environment.CommandLine中找到的用于文件路径的命令行.
If you''re talking about when the user double-clicks a .ABC file your application launches, there''s a couple of ways to get the command line arguments.

If you''ve got Application Framework enabled in your project properties, you can look in My.Application.CommandLineArgs() for the fully qualified path to the file.

If not, then you have to parse the command line found in Environment.CommandLine for the filepath.


使用Sysetm.IO命名空间.
然后尝试Path.GetFullPath(".abc"));之类的东西.

这应该给您路径.
Use Sysetm.IO namespace.
Then try something like Path.GetFullPath(".abc"));.

That should give you the path.


这将为您提供当前目录

This gives u the current directory

System.Environment.CurrentDirectory & "\extension.abc"


这篇关于获取处理文件的路径名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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