当前位置: 首页 > article >正文

C# 路径操作

一、打开程序所在路径

 try
 {
     string debugPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
     System.Diagnostics.Process.Start(debugPath);
 }
 catch (Exception ex)
 {
     MessageBox.Show("无法打开目录:" + ex.Message);
 }

运行结果:

二、获取程序所在路径下指定文件路径

 string debugPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
 debugPath = debugPath + "\\测试模板.csv";

 运行结果:


http://www.kler.cn/a/299261.html

相关文章:

  • CISC 和 RISC 架构的对比
  • 本地Linux服务器使用docker搭建DashDot并实现公网实时监测服务器信息
  • Linux 基础命令-文件与目录操作
  • python使用xpath获取html中的所有链接
  • 箱包潮湿发霉怎么处理 箱包发霉处理不长霉
  • Linux线程概念
  • Python VTK 绘制等高线初步
  • Linux学习-ELK(一)
  • VMware-Ubuntu Server安装教程
  • hive表格统计信息不准确
  • ISP面试准备2
  • HarmonyOS---应用测试概述
  • Linux 上安装 PostgreSQL
  • 初学者指南:掌握 Vue 路由(Router)
  • Redis协议与异步方式
  • HTML5( HTML5 、CSS3) 第一天
  • pytest 生成allure测试报告
  • PHP函数如何接收回调参数?
  • LCD彩条显示——FPGA学习笔记10
  • 在Spring中,相同类型不同ID的bean,与相同ID多次获取bean的区别和联系