您的位置:首页 > 编程语言 > C#

C#:如何获取安装文件所在的路径

2007-04-23 10:56 399 查看
using System;
using System.Collections.Generic;
using System.Text;

namespace MyConAPP
{
class Program
{
static void Main(string[] args)
{
string strFullAppName = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase;
if (strFullAppName.ToLower().IndexOf("file:///") >= 0)
{
strFullAppName = strFullAppName.Substring(8, strFullAppName.Length - 8);
}
string strAppPath = System.IO.Path.GetDirectoryName(strFullAppName);
Console.WriteLine(strAppPath);
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: