zoukankan      html  css  js  c++  java
  • [No000074]C#创建桌面快捷方式

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using IWshRuntimeLibrary;//添加引用(com->Windows Script Host Object Model)
    
    namespace 进制转换
    {
        class Program
        {
            static void Main(string[] args)
            {
                string DesktopPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop);//得到桌面文件夹 
                IWshRuntimeLibrary.WshShell shell = new IWshRuntimeLibrary.WshShell();
                IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(DesktopPath + "\ERP系统.lnk");
                shortcut.TargetPath = @"C:Windowswrite.exe";
                shortcut.Arguments = "";// 参数 
                shortcut.Description = "ERP系统";
                shortcut.WorkingDirectory = @"C:Windows";//程序所在文件夹,在快捷方式图标点击右键可以看到此属性 
                shortcut.IconLocation = @"C:Windowswrite.exe,0";//图标 
                shortcut.Hotkey = "CTRL+SHIFT+Z";//热键 
                shortcut.WindowStyle = 1;
                shortcut.Save();
                // 网站的快捷方式
                IWshRuntimeLibrary.IWshShortcut urlshortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(DesktopPath + "\自动创建+.lnk");
                urlshortcut.TargetPath = @"%HOMEDRIVE%/Program FilesInternet ExplorerIEXPLORE.EXE";
                urlshortcut.Arguments = "http://www.baidu.com";// 参数 
                urlshortcut.Description = "快捷链接到网站";
                urlshortcut.WorkingDirectory = System.Environment.CurrentDirectory;//Application.StartupPath;//程序所在文件夹,在快捷方式图标点击右键可以看到此属性 
                urlshortcut.IconLocation = @"%HOMEDRIVE%/Program FilesInternet ExplorerIEXPLORE.EXE, 0";//图标 
                urlshortcut.Hotkey = "CTRL+SHIFT+Z";//热键 
                urlshortcut.WindowStyle = 1;
                urlshortcut.Save();
            }
            /*
            说明:快捷方式创建时如果存在同名的快捷方式则会覆盖之前的快捷方式
            */
    
        }
    }
  • 相关阅读:
    迭代器求迄今为止所有的闰年
    记录列表中每个元素被访问的次数
    访问修改属性日志
    描述符
    摄氏与华氏转变
    【bzoj1925】[Sdoi2010]地精部落 组合数学+dp
    【bzoj1280】Emmy卖猪pigs 最大流
    【bzoj1449/bzoj2895】[JSOI2009]球队收益/球队预算 费用流
    【bzoj2721】[Violet 5]樱花 数论
    【bzoj4810】[Ynoi2017]由乃的玉米田 莫队算法+STL-bitset
  • 原文地址:https://www.cnblogs.com/Chary/p/No000074.html
Copyright © 2011-2022 走看看