0
這裏是我的代碼:如何在同一文件夾中創建我的項目.exe的快捷方式.exe位於?
private void button_Click_1(object sender, RoutedEventArgs e)
{
string link = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
+ System.IO.Path.DirectorySeparatorChar + System.Windows.Forms.Application.ProductName + ".lnk";
var shell = new WshShell();
var shortcut = shell.CreateShortcut(link) as IWshShortcut;
shortcut.TargetPath = System.Windows.Forms.Application.ExecutablePath;
shortcut.WorkingDirectory = System.Windows.Forms.Application.StartupPath;
//shortcut...
shortcut.Save();
}
此代碼在桌面上創建一個快捷方式......我想在我的exe文件相同的文件夾中創建一個快捷方式。我不能指出文件夾的路徑,因爲我不知道其他人會將其解包並運行它:(