ファイルに別の名前が付いているか、別のディレクトリから実行されている場合でも、基本的に、現在のプログラムが既に Windows スタートアップ フォルダーにリンクされているかどうかを確認したいと考えています。おそらくプログラムの名前を確認することで、これは可能ですか?
PS: このコードを使用して、プログラムをスタートアップ フォルダーにリンクします。
using (ShellLink shortcut = new ShellLink()) {
shortcut.Target = Application.ExecutablePath;
shortcut.WorkingDirectory = Path.GetDirectoryName(Application.ExecutablePath);
shortcut.Description = "My Shorcut Name Here";
shortcut.DisplayMode = ShellLink.LinkDisplayMode.edmNormal;
shortcut.Save(Environment.GetFolderPath(Environment.SpecialFolder.Startup));
}
ありがとう。