반응형
C#에서 현재 사용자의 데스크톱 경로를 얻는 방법
C#에서 현재 사용자의 데스크톱 경로를 얻으려면 어떻게 해야 합니까?
내가 찾을 수 있었던 건 VB뿐이었어다음 속성을 가진 NET 전용 클래스:
My.Computer.FileSystem.SpecialDirectories.Desktop
C#에서는 어떻게 하면 좋을까요?
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
// Environment.GetFolderPath
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); // Current User's Application Data
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData); // All User's Application Data
Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles); // Program Files
Environment.GetFolderPath(Environment.SpecialFolder.Cookies); // Internet Cookie
Environment.GetFolderPath(Environment.SpecialFolder.Desktop); // Logical Desktop
Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); // Physical Desktop
Environment.GetFolderPath(Environment.SpecialFolder.Favorites); // Favorites
Environment.GetFolderPath(Environment.SpecialFolder.History); // Internet History
Environment.GetFolderPath(Environment.SpecialFolder.InternetCache); // Internet Cache
Environment.GetFolderPath(Environment.SpecialFolder.MyComputer); // "My Computer" Folder
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); // "My Documents" Folder
Environment.GetFolderPath(Environment.SpecialFolder.MyMusic); // "My Music" Folder
Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); // "My Pictures" Folder
Environment.GetFolderPath(Environment.SpecialFolder.Personal); // "My Document" Folder
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); // Program files Folder
Environment.GetFolderPath(Environment.SpecialFolder.Programs); // Programs Folder
Environment.GetFolderPath(Environment.SpecialFolder.Recent); // Recent Folder
Environment.GetFolderPath(Environment.SpecialFolder.SendTo); // "Sent to" Folder
Environment.GetFolderPath(Environment.SpecialFolder.StartMenu); // Start Menu
Environment.GetFolderPath(Environment.SpecialFolder.Startup); // Startup
Environment.GetFolderPath(Environment.SpecialFolder.System); // System Folder
Environment.GetFolderPath(Environment.SpecialFolder.Templates); // Document Templates
언급URL : https://stackoverflow.com/questions/634142/how-to-get-a-path-to-the-desktop-for-current-user-in-c
반응형
'programing' 카테고리의 다른 글
Windows에서 스크린샷을 파일에 직접 저장하려면 어떻게 해야 합니까? (0) | 2023.04.10 |
---|---|
Echo newline in Bash prints 리터럴 \n (0) | 2023.04.10 |
Python: ImportError를 제공하는 Panda pd.read_excel:Excel 지원을 받으려면 xlrd > = 0.9.0 설치 (0) | 2023.04.10 |
매우 느린 HHVM, Wordpress, Nginx (0) | 2023.04.05 |
타자기로 할까요?아니면 ES6를 사용할 수 있을까요? (0) | 2023.04.05 |