[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:\Windows\write.exe";
            shortcut.Arguments = "";// 参数
            shortcut.Description = "ERP系统";
            shortcut.WorkingDirectory = @"C:\Windows";//程序所在文件夹,在快捷方式图标点击右键可以看到此属性
            shortcut.IconLocation = @"C:\Windows\write.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 Files\Internet Explorer\IEXPLORE.EXE";
            urlshortcut.Arguments = "http://www.baidu.com";// 参数
            urlshortcut.Description = "快捷链接到网站";
            urlshortcut.WorkingDirectory = System.Environment.CurrentDirectory;//Application.StartupPath;//程序所在文件夹,在快捷方式图标点击右键可以看到此属性
            urlshortcut.IconLocation = @"%HOMEDRIVE%/Program Files\Internet Explorer\IEXPLORE.EXE, 0";//图标
            urlshortcut.Hotkey = "CTRL+SHIFT+Z";//热键
            urlshortcut.WindowStyle = 1;
            urlshortcut.Save();
        }
        /*
        说明:快捷方式创建时如果存在同名的快捷方式则会覆盖之前的快捷方式
        */

    }
}
时间: 2024-08-13 05:39:42

[No000074]C#创建桌面快捷方式的相关文章

手把手教你在ubuntu下创建桌面快捷方式

习惯使用windows的朋友来说创建桌面快捷方式简直就是so easy, 鼠标右键点击文件-->选择发送桌面快捷方式,就OK了.对于ubuntu下该怎样创建桌面快捷方式呢?下面以创建eclipse的快捷方式为例,简单介绍一下. 环境: 1)系统版本:Ubuntu 14.04 2)桌面环境:Unity 3)已经下载并解压eclipse(免安装)到/opt目录下 详细步骤: 1)新建文件eclipse.desktop,命令如下: sudo vim /usr/share/applications/ec

ios 创建桌面快捷方式

iOS上创建桌面快捷方式 应用场景: 在iOS设备桌面创建app内某一个模块或页面的快捷方式,通过该快捷方式可以直接进入相应模块或页面.目前app内有该功能的有高德一键导航,360安全卫士的小火箭. 技术原理: 在iOS开发中可以使用openUrl的方式打开一个网页,并通过Safari浏览器的发送到主屏幕从而创建一个网页的快捷方式,这篇文章就是利用这个方法来创建一个app的桌面快捷方式.首先在app内部开启一个轻量级的HttpServer,利用openurl:127.0.0.1 的方式打开本地页

ubuntu12.4创建桌面快捷方式(三种方法)

ubuntu12.4创建桌面快捷方式(三种方法) ubuntu12.4 不能在桌面"右键-->创建启动器" ,所以要另寻方法来创建桌面快捷图标. 1.方法一: 在文件系统  /usr/share/applications  存放着ubuntu 自动安装软件的快捷方式: 如:直接右键 "终端"然后复制到桌面: 双击就可以打开,这下不需用快捷键  Ctrl+Alt+T  了: 2.方法二: 鼠标按住图标往桌面拉,同时按住 Alt  键: 拖到桌面的时候会看到有几个

ubuntu创建桌面快捷方式

ubuntu11.04之前的版本,鼠标在桌面右键可以有更方便的创建快捷方式的方法,之后就没有了. 1.创建一个文件,将下面的代码拷贝进去 这里我们只需要关注3个地方,分别为Exec=软件执行文件的路径,Icon=快捷方式图标(如果有的话),Name=快捷方式名称.根据自己软件按转的位置修改代码,保存之后关闭文件.下面以eclipse为例. [Desktop Entry] Categories=Development; Comment[zh_CN]= Comment= Exec=/home/owe

为eclipse创建桌面快捷方式

为eclipse创建桌面快捷方式 在linux桌面空白处,点击鼠标右键,弹出一个对话框,选择"create Launcher"(中文是"新建启动器"),在"Create Launcher"(中文"创建快捷方式")对话框中选择Application(中文"应用程序"),输入名字:eclipse ,在Command(中文"命令")找到eclipse的启动程序(比如我的是:/opt/eclip

解决Inno Setup制作安装包无法创建桌面快捷方式的问题

转自:http://yedward.net/?id=104 昨天想把个java程序做成exe安装软件,然后就去下载了Inno Setup这个软件安装包制作软件,Inno Setup这个软件确实非常好用,但是由于我下载的中文汉化版,根据向导一步步来就是不创建桌面快捷方式,折腾了很久,终于找到了解决方法. 下面是我使用Inno Setup打包软件后自动生成的一段代码: 1 2 3 [Tasks] Name: "desktopicon"; Description: "{cm:Cre

WPF 创建桌面快捷方式

#region 创建桌面快捷方式 string deskTop = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop); string dirPath = System.Environment.CurrentDirectory; string exePath = Assembly.GetExecutingAssembly().Location; System.Diagnostics.FileVers

(转)Inno Setup入门(四)——为程序创建桌面快捷方式

本文转载自:http://blog.csdn.net/augusdi/article/details/8564810 Icons这一可选段定义所有创建在开始菜单和\或其它位置 (比如桌面) 的快捷方式.一个例子如下: [setup] ;全局设置,本段必须 AppName=Test AppVerName=TEST DefaultDirName="E:\TEST" AppVersion=1.0 [files] Source: "F:\desktop\ipmsg.exe"

windows创建桌面快捷方式的VBA脚本

Dim wShell, oShortcut    'Dim strDesktop$ ' 为了与VBS兼容,    Dim strDesktop    ' 这里改写一下,测试通过...    Set wShell = CreateObject("Wscript.shell")    strDesktop = wShell.SpecialFolders("Desktop")    strDesktop = strDesktop + "\搜物网-货源必备.lnk