• 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.
  • Sohbetokey.com ile canlı okey oynamaya ne dersin? Hem sohbet et, hem mobil okey oyna!
  • Soru mu? Sorun mu? ''Bir Sorum Var?'' sistemimiz aktiftir. Paylaşın beraber çözüm üretelim.
Bu, hızlı yüklenen mobil optimize edilmiş bir AMP sayfadır, gerçek sayfayı yüklemek istiyorsanız bu metni tıklayın.

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

Üyelik Tarihi
7 Ocak 2015
Konular
4,091
Mesajlar
4,274
MFC Puanı
40
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();

        }
    }
}