개발 노트

C# 폴더열기 본문

프로그래밍/C#

C# 폴더열기

알 수 없는 사용자 2022. 3. 4. 14:55
using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

 

namespace FolderOpen

{

    class Program

    {

        static void Main(string[] args)

        {

            //사용자가 열고자 하는 폴더 경로 지정

            string localFolderPath = @"D:\";

            //D드라이브 폴더 실행

            System.Diagnostics.Process.Start(localFolderPath);

        }

    }

}
//내 폴더 위치 불러오기
System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
 
//폴더 있는지 확인하고 생성하기
if(!Directory.Exists("path"))
{
     System.IO.Directory.CreateDirectory("path");
}
 
//폴더 열기
 System.Diagnostics.Process.Start("FolderPath")

 

 

 

참고링크

https://outshine90.tistory.com/entry/C-%ED%8F%B4%EB%8D%94-%ED%99%95%EC%9D%B8-%EC%83%9D%EC%84%B1-%EC%97%B4%EA%B8%B0

https://afsdzvcx123.tistory.com/entry/C-%EB%AC%B8%EB%B2%95-C-%ED%8F%B4%EB%8D%94-%EC%97%B4%EA%B8%B0-%E2%80%93-Process-Start