VnexTR: Bilişim Forumu

Tam Versiyon: Kısa Yol Oluşturma Kısa Yolu Startup Klasörüne Kopyalama
Şu anda arşiv modunu görüntülemektesiniz. Tam versiyonu görüntülemek için buraya tıklayınız.
Kod:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using IWshRuntimeLibrary;

namespace C_Sharp_Run_Exe_Startup
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private **** button1_Click(object sender, EventArgs e)
{
//startup adresini string tipinde bir değişkene atayalım

string startUpPath = Environment.GetFolderPath(Environment.SpecialFolder.Startup);

//WshShell den bir örnek oluşturalım

WshShell shell = new WshShell();

// kısa yolu oluşturacağımız adresi bir string değişkene atayalım

string shortcutAddress = Environment.GetFolderPath(Environment.SpecialFolder.Startup) + @"\HesapMakinesi.lnk";

//kısayol adresinden kısayol nesnesini oluşturalım

IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutAddress);

shortcut.Description = "Hesap Makinesi Kısayolu";

//kısa yolun açacağı uygulamanın adresini kısayol nesnesinin hedef adresine atayalım

shortcut.TargetPath = Environment.GetFolderPath(Environment.SpecialFolder.System) + @"\calc.exe";

//Kısayolu oluşturmak için save metodunu çalıştıralım.

shortcut.Save();

}
}
}
Teşekkürler.