using System;
using IWshRuntimeLibrary;
using System.IO;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("create client quick link start");
string shortcutName = "客户端";//快捷方式名称
string targetPath = AppDomain.CurrentDomain.BaseDirectory.ToString() + "../run_client.bat";//目标可执行文件
string iconLocation = AppDomain.CurrentDomain.BaseDirectory.ToString() + "icon.ico";//ico图标路径
ShortCutHelper.CreateShortcutOnDesktop(shortcutName, targetPath, shortcutName, iconLocation);
Console.WriteLine("create client quick link end");
Console.WriteLine("create server quick link start");
string shortcutName2 = "服务端";//快捷方式名称
string targetPath2 = AppDomain.CurrentDomain.BaseDirectory.ToString() + "../run_server.bat";//目标可执行文件
string iconLocation2 = AppDomain.CurrentDomain.BaseDirectory.ToString() + "icon.ico";//ico图标路径
ShortCutHelper.CreateShortcutOnDesktop(shortcutName2, targetPath2, shortcutName2, iconLocation2);
Console.WriteLine("create server quick link end");
}
public class ShortCutHelper
{
//需要引入IWshRuntimeLibrary,搜索Windows Script Host Object Model
//需要引用Microsoft.Csharp
/// <summary>
/// 创建快捷方式
/// </summary>
/// <param name="directory">快捷方式所处的文件夹</param>
/// <param name="shortcutName">快捷方式名称</param>
/// <param name="targetPath">目标路径</param>
/// <param name="description">描述</param>
/// <param name="iconLocation">图标路径,格式为"可执行文件或DLL路径, 图标编号",
/// 例如System.Environment.SystemDirectory + "\\" + "shell32.dll, 165"</param>
/// <remarks></remarks>
public static void CreateShortcut(string directory, string shortcutName, string targetPath,
string description = null, string iconLocation = null)
{
try
{
if (!System.IO.Directory.Exists(directory))
{
System.IO.Directory.CreateDirectory(directory);
}
string shortcutPath = Path.Combine(directory, string.Format("{0}.lnk", shortcutName));
WshShell shell = new WshShell();
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutPath);//创建快捷方式对象
shortcut.TargetPath = targetPath;//指定目标路径
shortcut.WorkingDirectory = Path.GetDirectoryName(targetPath);//设置起始位置
shortcut.WindowStyle = 1;//设置运行方式,默认为常规窗口
shortcut.Description = description;//设置备注
shortcut.IconLocation = string.IsNullOrWhiteSpace(iconLocation) ? targetPath : iconLocation;//设置图标路径
shortcut.Save();//保存快捷方式
}
catch { }
}
/// <summary>
/// 创建桌面快捷方式
/// </summary>
/// <param name="shortcutName">快捷方式名称</param>
/// <param name="targetPath">目标路径</param>
/// <param name="description">描述</param>
/// <param name="iconLocation">图标路径,格式为"可执行文件或DLL路径, 图标编号"</param>
/// <remarks></remarks>
public static void CreateShortcutOnDesktop(string shortcutName, string targetPath, string description = null, string iconLocation = null)
{
string desktop = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);//获取桌面文件夹路径
CreateShortcut(desktop, shortcutName, targetPath, description, iconLocation);
}
}
}
}
相关推荐
LPC2124定时器实现跑马灯
文章目录一、keil 4新建工程 一、keil 4新建工程 1、Create New Project,注意,最好添加进一个新建好的文件夹里,keil不会帮你新建。 2、添加设备类型:NXP目录下的LPC2124 3、选择启动文件Startu.s 4、new 一个file,保存命名为.c文件 5、添加进project里,右击,add 选中,添加 6、设置编译输出.hex文件 ...
在 .NET 中创建快捷方式 [C#][转载]
在 .NET 中创建快捷方式 [C#] Creating Shortcuts in .NET [C#] Written by Allen Lee 创建快捷方式对于绝大多数 Windows 用户来说都是小菜一碟了,然而,这项工作却为程序员带来不少麻烦。.NET 没有提供简便直接的创建快捷方式的方法,那么在 .NET 中我们如何为应用程序创建快捷方式呢? ...
宇树机器人G1二次开发:导览、起始点、目的地与完整示例
通过宇树G1 SDK的导航接口,开发者可以高效地实现机器人的自主移动功能。连接 -> 设置目标点 -> 发送命令 -> 监控状态。本文提供的完整示例涵盖了从环境搭建到代码实现的全部步骤,并解释了起始点、目的地等关键概念。开发者可以在此基础上,结合多目标点巡逻、动态避障(需高级配置)等功能,构建更复杂的机器人应用。建议读者先在小范围、熟悉的平坦环境中测试,成功后再逐步扩展到更复杂的场景。
html注释
html部分 快捷方式 <!-- 就是变成 js部分就是// css部分就是 /* */
致远OA系统表单相关操作记录(一)
致远OA系统表单相关操作
如何使用Dify 搭建一个用自然语言查询数据库的 Agent?
这样就会发布完毕。
net 服务器端网站创建快捷方式,Asp.Net-创建网站的快捷方式到桌面,开始菜单,收藏夹...
/// /// 创建快捷方式/// /// 标题/// URL地址public static void CreateShortcut(string Title, string URL){try{string strFavoriteFolder;// “收藏夹”中 创建 IE 快捷方式strFavoriteFolder = System.Environment.GetFolderPath(Envir...
【软件系统架构】系列六:系统工程
系统工程是一种跨学科方法论,用于分析、设计、集成和管理复杂系统的全生命周期。其核心特点包括系统性思维、全周期管理、跨学科协作和需求导向。主流采用V模型生命周期,涵盖需求分析、系统设计、实现、测试验证及运维退役等阶段。核心工作方法包括需求工程、系统建模、接口设计、风险管理等。系统工程与项目管理协同,分别侧重技术实现和进度资源管理。应用领域覆盖航天军工、智能制造、智慧城市等。未来将向AI融合、数字孪生、模型驱动工程等方向发展,为复杂系统开发提供系统化协作范式。
vb.net创建快捷式
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' 直接调用COM对象 Dim wsh As Object = CreateObject("WScr
[RK3568 Android11] 开发之蓝牙(AP6275S)
前言 蓝牙是一种支持设备短距离通信(一般10m内)的无线电技术,能在包括移动电话、PDA、无线耳机、笔记本电脑、相关外设等众多设备之间进行无线信息交换。利用“蓝牙”技术,能够有效地简化移动通信终端设备之间的通信,也能够成功地简化设备与因特网Internet之间的通信,从而数据传输变得更加迅速高效,为无线通信拓宽道路。 接下来是在RK3568上调试AP6275S模块蓝牙部分: 一、设备树dts配置 根据硬件原理图,找到对应的控制引脚,配置好dts: ...
RK3568平台(USB篇)USB基础知识
现象:把USB设备比如Android手机接到PC答1:是USB控制器,是USB控制器内嵌的root hub.答2. windows里已经有了USB的总线驱动程序,接入USB设备后,是"总线驱动程序"知道你是"android phone"提示你安装的是"设备驱动程序"。USB总线驱动程序负责:识别USB设备, 给USB设备找到对应的驱动程序。答3. PC的USB口内部,D-和D+接有15K的下拉电阻,未接USB设备时为低电平USB设备的USB口内部,D-或D+接有1.5K的上拉电阻;
VB.NET创建桌面快捷方式
'''<summary>'''创建桌面快捷方式'''</summary>'''<remarks></remarks>PrivateSubCreateDesktopShortcut()DimappName=My.Application.Info.CompanyName&M...
fbx bip互转 测试OK
fbx bip互转
.NET 应用程序中创建桌面快捷方式
C++.NET 编写的托管DLL,可以应用直接使用 Download Source and DLL// ShortCut.h#pragma onceusing namespace System;using namespace System::Runtime::InteropServices;namespace ShortCutLib{ public __gc class ShortCut
深度学习工具包 DeepLearningToolbox
深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[](https://bitdeli.com/free "Bitdeli Badge")
文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况
主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。
Asp.Net-创建网站的快捷方式到桌面,开始菜单,收藏夹
protected void Page_Load(object sender, EventArgs e) { CreateShortcut("baidu", "http://www.baidu.com"); } /// /// 创建快捷方式 /// /// 标题
C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片
基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正
批处理实现c/s程序部署,以及创建桌面快捷方式
@echo offecho "即将开始安装,按任意键开始复制文件......"pausexcopy //192.168.1.112/source/ d:/XSIBMS/ //我从这个地址复制文件到我的d盘下面的xsibms文件夹下面d:cd xsibms //进入到这个目录下CreateShortCut.vbs //运行这个文件,实现桌面快捷方式echo "文件复制安装已经完成
WINCC7.3破解文件
WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!
用C# 创建快捷方式
C# 创建快捷方式 以下代码在2.0,3.0,3.5 下都可以正常运行,在4.0在报错。 不知道那为仁兄知道在4.0下创建快捷方式。 选择 COM 选项卡并选择 Windows Script Host Object Model using IWshRuntimeLibrary; namespace ConsoleApplication1 { clas...
asp.net 实现 桌面快捷方式
<br />如果想让你的网站在桌面建立快捷方式,点击快捷方式图标打开网站。<br />那就得用url类型文件来实现。<br /> <br />本想模仿开心网的“设为桌面图标”来实现,可惜是php的在asp.net中用不了。<br />而且按照好多网上的说的都无法实现,都是空连接无效的快捷方式。<br /> <br />经过多方的研究终于解决了这问题共享给大家,希望和我有同样问题的人能够得到帮助。<br /> <br />一下是实现代码,添加后就可以使用。已经经过了测试。<br /> Respo
Net应用程序发布的解决方案 最新整理 (可加桌面快捷 在程序中加自己的ICO及自动卸载等)
Net应用程序发布的解决方案 最新整理 (可加桌面快捷 在程序中加自己的ICO及自动卸载等)
Asp.NET生成各种网页快捷方式(桌面url快捷方式,收藏夹/开始菜单快捷方式)(转帖)
<br />1 using System;<br /> 2 using System.Data;<br /> 3 using System.Configuration;<br /> 4 using System.Collections;<br /> 5 using System.Web;<br /> 6 using System.Web.Security;<br /> 7 using System.Web.UI;<br /> 8 using System.Web.UI.WebControls;<br />
asp.net 桌面快捷方式
给asp.net项目安装程序添加快捷方式//添加以下引用:COM 下 Windows Script Host Object Model,然后 //using System.Runtime.InteropServices; //using IWshRuntimeLibrary; private void AddShortcut(){ string[] vPath
ext .net 后台动态创建desktop.module ,window, GridPanel
1 动态创建module Dim objMod As Ext.Net.DesktopModule Dim objModShortcut As Ext.Net.DesktopShortcut 'Desktop1.DesktopConfig.Wallpaper = "Styles/window72.jpg" objM
Asp.NET生成各种网页快捷方式(桌面url快捷方式,收藏夹/开始菜单快捷方式)
Asp.NET生成各种网页快捷方式(桌面url快捷方式,收藏夹/开始菜单快捷方式) using System; 2 using System.Data; 3 using System.Configuration; 4 using System.Collections; 5 using System.Web; 6 using System.Web.Security;
《网站桌面快捷方式》下载源码
一段桌面快捷方式源码,这个是用vb.net for asp来写的,就是客户在打开网站,下载这个段代码,可以存为桌面,就可以以后方便打开了,可以根据自已的需要进行修改哈 Dim Html As String = "[InternetShortcut]" & vbCrLf, Html &= "URL=http://www.cqwsc.co...
5753



被折叠的 条评论
为什么被折叠?



