我是非常新的代码,我想知道如何链接visual studio中的按钮以打开桌面上的文件? System.Diagnostics.Process.Start("C:/Users/Desktop");
Doesent工作
请帮助:D
答案 0 :(得分: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);