ウィンドウのスタートアップでスタートアップエントリを作成しています。ユーザーが msconfig スタートアップ ウィンドウを使用してエントリの選択を解除すると、アプリが重複したエントリを作成します。既存のエントリが存在する場合は削除するか、重複の作成をスキップする必要があります。どうやってやるの?
スタートアップ エントリを作成する私のコードは次のとおりです。
string startUpFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\" + "MyexeName.exe";
if (System.IO.File.Exists(startUpFolderPath))
{
return;
}
WshShellClass wshShell = new WshShellClass();
IWshRuntimeLibrary.IWshShortcut shortcut;
shortcut = (IWshRuntimeLibrary.IWshShortcut)wshShell.CreateShortcut(startUpFolderPath);
shortcut.TargetPath = Application.ExecutablePath;
shortcut.WorkingDirectory = Application.StartupPath;
shortcut.Save();