C# 获取上一级目录

DirectoryInfo info = new DirectoryInfo(Application.StartupPath); 
String path = info.Parent.Parent.FullName;

DirectoryInfo info = new DirectoryInfo("c:\\windows\\temp"); 
String path = info.Parent.Parent.FullName;

 

posted @ 2023-11-09 09:00  懒人境界  阅读(6)  评论(0编辑  收藏  举报