• Web sitemizin içeriğine ve tüm hizmetlerimize erişim sağlamak için Web sitemize kayıt olmalı ya da giriş yapmalısınız. Web sitemize üye olmak tamamen ücretsizdir.

Bir Uygulamanın Kısa Yolunu Oluşturma ve Kısa Yolu Startup Klasörüne Kopyalama

  • Konuyu Başlatan Konuyu Başlatan ByOnur58
  • Başlangıç tarihi Başlangıç tarihi

ByOnur58

Kayıtlı Üye
Forum Yaşı
11 Yıl 5 Ay
Mesajlar
2,114
Tepkime puanı
10
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();

        }
    }
}
 
Geri
Üst