2016-08-26 2 views
-2

Im 매우 새로운 코드이며 바탕 화면에서 파일을 열려면 Visual Studio의 단추를 어떻게 연결해야합니까? System.Diagnostics.Process.Start("C:/Users/Desktop"); Doesent 작업 도와주세요 : D 여기바탕 화면에서 파일을 여는 방법 C#

+2

당신은 "/ 사용자//데스크탑/ C"사용자 이름을'누락이. 다음과 같이 현재 사용자의 데스크톱 경로를 얻을 수 있습니다 :'string path = Environment.GetFolderPath (Environment.SpecialFolder.Desktop); ' –

+0

exaple을 제발 주시겠습니까? –

+0

폴더를 열시겠습니까? 또는 사용자가 특정 폴더에서 파일을 열 수있는 대화 상자를 표시하겠습니까? 또는 파일 내용을 읽으시겠습니까? – kurakura88

답변

1

원하는 예입니다 : ':

// Get the desktop folder path of the current user 
string folderpath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)‌​; 
// define the filename of the file you want to open 
string filename = "desktop.ini"; 
// Get the full path of the folder and filename combined. Path.Combine will add slash automatically 
string filepath = System.IO.Path.Combine(folderpath, filename); 
// Open the file with the defined filepath 
System.Diagnostics.Process.Start(filepath); 
+0

https://gyazo.com/57d6636d4a1086771fed36887f282286 –

+0

예제를 변경했습니다. Path 변수의 이름을 바꾸고 Path.Combine에 system.io를 사용하는 것을 잊었습니다. –

+0

이 작업을 수행 할 수 있습니까? [link] http://pastebin.com/5PUgJ6aY? –

관련 문제