0
はここに私のコードです:プロジェクトのショートカットを作成する方法.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ファイルが同じフォルダ内に作成することにしたいです。私は他の人がそれを解凍して実行する場所を知らないので、フォルダパスを指定することはできません:(