我自己写了一个window服务 服务需要获取bin/debug/ 目录下面的一个配置文件我写完整路径 1. C:\\Users\\admin\\Documents\\...\\bin\\Debug\\Variables.config 这样可以读取但是写成 2. Environment.CurrentDirectory + “\\Variables.config” 就不行,
日志里会显示 未能找到文件“C:\Windows\system32\Variables.config”。 的错误。关键是 1和2 是一样的路径啊
求大神说下怎么不写完整路径来获取配置文件
日志里会显示 未能找到文件“C:\Windows\system32\Variables.config”。 的错误。关键是 1和2 是一样的路径啊
求大神说下怎么不写完整路径来获取配置文件
C:\Users\admin\Documents\..\bin\Debug\xxxx.exe而我要获取的是 C:\Users\admin\Documents\...\bin\Debug\xxxx.config请问怎么获取。
path=Path.GetFullPath(path);
path=Path.Combine(path,"xxxx.config");