-2

I want to open a folder that is in the same directory as my form

An example of this would be I have a folder named Folder1 in the directory of my form / exe, and you would click a button to open Folder1, how would I do that?

I tried doing

System.Diagnostics.Process.Start("explorer.exe", AppDomain.CurrentDomain + @"\Folder1");

there was no error, it was just a prompt that said "You need a new app to open this"

chili
  • 1
  • 2

1 Answers1

0

Use this code

System.Diagnostics.Process.Start("explorer.exe" , AppDomain.CurrentDomain.BaseDirectory+"Folder1");
Nima
  • 96
  • 1
  • 1
  • 14
  • This is missing the separator (e.g. baskslach). I would highly recomment to use Path.Combine instead of string concatenation. – Klaus Gütter Aug 22 '22 at 06:04
  • And using path combine : System.Diagnostics.Process.Start("explorer.exe",Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Folder1")); – Nima Aug 22 '22 at 06:07