I have create next path:
StringBuilder sb = new StringBuilder();
sb.Append(Environment.CurrentDirectory.ToString());
Its path: d:\????????????????\?#\My projects\MyToolBar(new)\TestToolBar\TestToolBar\bin\Debug\
And i need: d:\????????????????\?#\My projects\MyToolBar(new)\TestToolBar\TestToolBar\bin\
How returning to the same directory ago?
Loading
Zoran HorvatPosted Aug 2, 2011, 10:13 AM
DirectoryInfo dir = new DirectoryInfo(Directory.GetCurrentDirectory());
Directory.SetCurrentDirectory(dir.Parent.FullName);
Or:
Directory.SetCurrentDirectory(Directory.GetCurrentDirectory() + "\\..");
In the first case, you have directory path in dir.Parent.FullName.
Zoran
Mike JonsonPosted Aug 2, 2011, 10:19 AM
Dorababu MekaPosted Aug 2, 2011, 10:06 AM