• XSS.stack #1 – первый литературный журнал от юзеров форума

Автозапуск на винде

как вариант c#

Код:
using IWshRuntimeLibrary;
using System.IO;

        string appName = "NameProgram";
        string appPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
        public static void AddToStartup(string appName, string appPath)
        {

            string startupFolder = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
            string shortcutPath = Path.Combine(startupFolder, appName + ".lnk");

            if (!File.Exists(shortcutPath))
            {
                WshShell shell = new WshShell();
                IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutPath);
                shortcut.Description = "My application description";
                shortcut.TargetPath = appPath;
                shortcut.Save();
            }
        }
 


Напишите ответ...
  • Вставить:
Прикрепить файлы
Верх