当前位置:首页 » 编程软件 » 创建快捷方式脚本

创建快捷方式脚本

发布时间: 2022-08-20 01:06:13

① 如何创建快捷方式有几种办法

创建快捷方式有两种:

第一种

1、找到要创建快捷方式的文件,选中。

② 用bat创建快捷方式的方法。

1楼
方式一创建的“画图.url”在XP中运行时提示“该文件没有程序与之关联。。。。。”

比较方便实用的两种方法如下:

直接生成BAT调用文件的批处理代码如下:
@echo>"%USERPROFILE%\桌面\123.bat" @start "" "%cd%\123.txt"

调用VBS生成快捷方式的批处理代码如下:
@echo off
set shortCutPath="%USERPROFILE%\桌面\123.lnk"
set file=%cd%\123.txt
(echo Dim WshShell,Shortcut
echo Dim path,fso
echo path="%file%"
echo Set fso=CreateObject^("Scripting.FileSystemObject"^)
echo Set WshShell=WScript.CreateObject^("WScript.Shell"^)
echo Set Shortcut=WshShell.CreateShortCut^(%shortCutPath%^)
echo Shortcut.TargetPath=path
echo Shortcut.Save
)>tmp.vbs
start /wait "" tmp.vbs
del /f/q tmp.vbs

③ 如何使用 Windows 脚本宿主创建桌面快捷方式

如何使用 Windows 脚本宿主创建桌面快捷方式
电子邮件
打印
注意:这篇文章是由无人工介入的微软自动的机器翻译软件翻译完成。微软很高兴能同时提供给您由人工翻译的和由机器翻译的文章, 以使您能使用您的语言访问所有的知识库文章。然而由机器翻译的文章并不总是完美的。它可能存在词汇,语法或文法的问题,就像是一个外国人在说中文时总是可能犯这样的错误。虽然我们经常升级机器翻译软件以提高翻译质量,但是我们不保证机器翻译的正确度,也不对由于内容的误译或者客户对它的错误使用所引起的任何直接的, 或间接的可能的问题负责。

点击这里察看该文章的英文版: 244677
概要
Microsoft Windows 脚本宿主 (WSH) 是一种工具,使您可以运行 Microsoft Visual Basic 脚本版本和 JScript 本身内基本操作系统,Windows 95 或 Windows NT 4.0 上。它还包括了多个 COM 自动化方法,您可以执行多项任务很容易地通过 Windows 脚本宿主对象模型。Microsoft Windows 脚本宿主集成到 Windows 98、 Windows 2000 和更高版本的 Windows 操作系统。它可用于为 Windows NT 4.0 安装了 Windows NT 4.0 选项包。若要下载此工具,请访问下面的 Microsoft 开发人员网络 (MSDN) Web 站点 ︰
http://msdn2.microsoft.com/en-us/library/ms950396.aspx
详细信息
这个程序演示了如何使用 Windows 脚本宿主可以在 Windows 桌面上创建一个快捷方式。为了运行此示例,您必须在您的计算机上安装 Windows 脚本宿主。若要运行这些示例,请将下面的代码复制到一个新的程序文件,并运行它。
示例 1

WshShell = CreateObject("Wscript.shell")
strDesktop = WshShell.SpecialFolders("Desktop")
oMyShortcut = WshShell.CreateShortcut(strDesktop + "\Sample.lnk")
oMyShortcut.WindowStyle = 3 &&Maximized 7=Minimized 4=Normal
oMyShortcut.IconLocation = "C:\myicon.ico"
OMyShortcut.TargetPath = "%windir%\notepad.exe"
oMyShortCut.Hotkey = "ALT+CTRL+F"
oMyShortCut.Save

示例 2
(添加命令行参数)

WshShell = CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
oMyShortCut= WshShell.CreateShortcut(strDesktop+"\Foxtest.lnk")
oMyShortCut.WindowStyle = 7 &&Minimized 0=Maximized 4=Normal
oMyShortcut.IconLocation = home()+"wizards\graphics\builder.ico"
oMyShortCut.TargetPath = "c:\Program Files\Microsoft Visual Studio\VFP98\vfp6.exe"
oMyShortCut.Arguments = '-c'+'"'+Home()+'config.fpw'+'"'
oMyShortCut.WorkingDirectory = "c:\"
oMyShortCut.Save

注意:根据您正在使用的 Visual FoxPro 的版本,您可能需要更改名称和 Visual FoxPro 示例 2 中的可执行文件的路径。
示例 3
(将 URL 快捷方式添加到桌面)

WshShell = CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
oUrlLink = WshShell.CreateShortcut(strDesktop+"\Microsoft Web Site.URL")
oUrlLink.TargetPath = "http://www.microsoft.com"
oUrlLink.Save

注意:要创建的快捷方式,必须对所有方法传递有效参数。如果其中一个参数不正确,会不出现任何错误。
引用
有关其他信息,查找 Microsoft 开发人员网络 (MSDN) 网站上的以下引用 ︰
http://msdn2.microsoft.com/en-us/library/ms950396.aspx
白皮书 ︰
Windows 脚本宿主 ︰ 通用脚本主机脚本语言

技术白皮书 ︰
Windows 脚本主机程序员参考
警告:本文已自动翻译
属性
文章 ID:244677 - 上次审阅时间:08/27/2007 05:54:22 - 修订版本: 3.6
这篇文章中的信息适用于:
Microsoft Visual FoxPro 3.0 标准版
Microsoft Visual FoxPro 3.0b 标准版
Microsoft Visual FoxPro 5.0 标准版
Microsoft Visual FoxPro 5.0a
Microsoft Visual FoxPro 6.0 专业版
Microsoft Visual FoxPro 7.0 Professional Edition
Microsoft Visual FoxPro 8.0 专业版
Microsoft Visual FoxPro 9.0 Professional Edition
关键字:
kbmt kbhowto kbmisctools kbscript KB244677 KbMtzh

④ 如何用Bat文件创建桌面快捷方式。

批处理创建快捷方式的四种方法

方法一,url式的快捷方式
echo [InternetShortcut] >>"%USERPROFILE%\桌面\画图.url"
echo URL="%SystemRoot%\system32\mspaint.exe" >>"%USERPROFILE%\桌面\画图.url"
echo IconIndex=0 >>"%USERPROFILE%\桌面\画图.url"
echo IconFile="%SystemRoot%\system32\mspaint.exe" >>"%USERPROFILE%\桌面\画图.url"

方法二,外部命令
shortcut.exe /f:"%USERPROFILE%\桌面\画图.lnk" /a:c /t:"%SystemRoot%\system32\mspaint.exe"
shutcut可以在本论坛上下载,同样希望高手给补充一下为快捷方式添加说明的代码

方法三,VBScript脚本
@echo
set shortCutPath="%USERPROFILE%\桌面\画图.lnk"
echo Dim WshShell,Shortcut>>tmp.vbs
echo Dim path,fso>>tmp.vbs
echo path="%SystemRoot%\system32\mspaint.exe">>tmp.vbs
echo Set fso=CreateObject("Scripting.FileSystemObject")>>tmp.vbs
echo Set WshShell=WScript.CreateObject("WScript.Shell")>>tmp.vbs
echo Set Shortcut=WshShell.CreateShortCut(%shortCutPath%)>>tmp.vbs
echo Shortcut.TargetPath=path>>tmp.vbs
echo Shortcut.Save>>tmp.vbs
"%SystemRoot%\System32\WScript.exe" tmp.vbs
@del /f /s /q tmp.vbs
pause

方法四,winrar
@echo off
echo Path=%%SystemRoot%%\system32\>test.txt
echo Silent=^2>>test.txt
echo Overwrite=^1>>test.txt
echo Shortcut=D, "mspaint.exe", "\", "创建和编辑图画,以及显示和编辑扫描获得的图片。", "图画">>test.txt
start /wait winrar.exe a -r -ep1 -m1 -sfx -ztest.txt test.exe %SystemRoot%\system32\mspaint.exe
start /wait test.exe
del test.*

热键和数值的对应关系
833 - ctrl + shift + a
834 - ctrl + shift + b
835 - ctrl + shift + c
836 - ctrl + shift + d
837 - ctrl + shift + e
838 - ctrl + shift + f
.
.
1601 - ctrl + alt + a
1602 - ctrl + alt + b
1603 - ctrl + alt + c
1604 - ctrl + alt + d
1605 - ctrl + alt + e
1606 - ctrl + alt + f

⑤ 用BAT创建快捷方式到桌面

批处理创建快捷方式的四种方法

方法一,url式的快捷方式
echo [InternetShortcut] >>"%USERPROFILE%\桌面\画图.url"
echo URL="%SystemRoot%\system32\mspaint.exe" >>"%USERPROFILE%\桌面\画图.url"
echo IconIndex=0 >>"%USERPROFILE%\桌面\画图.url"
echo IconFile="%SystemRoot%\system32\mspaint.exe" >>"%USERPROFILE%\桌面\画图.url"

方法二,外部命令
shortcut.exe /f:"%USERPROFILE%\桌面\画图.lnk" /a:c /t:"%SystemRoot%\system32\mspaint.exe"
shutcut可以在本论坛上下载,同样希望高手给补充一下为快捷方式添加说明的代码

方法三,VBScript脚本
@echo
set shortCutPath="%USERPROFILE%\桌面\画图.lnk"
echo Dim WshShell,Shortcut>>tmp.vbs
echo Dim path,fso>>tmp.vbs
echo path="%SystemRoot%\system32\mspaint.exe">>tmp.vbs
echo Set fso=CreateObject("Scripting.FileSystemObject")>>tmp.vbs
echo Set WshShell=WScript.CreateObject("WScript.Shell")>>tmp.vbs
echo Set Shortcut=WshShell.CreateShortCut(%shortCutPath%)>>tmp.vbs
echo Shortcut.TargetPath=path>>tmp.vbs
echo Shortcut.Save>>tmp.vbs
"%SystemRoot%\System32\WScript.exe" tmp.vbs
@del /f /s /q tmp.vbs
pause

方法四,winrar
@echo off
echo Path=%%SystemRoot%%\system32\>test.txt
echo Silent=^2>>test.txt
echo Overwrite=^1>>test.txt
echo Shortcut=D, "mspaint.exe", "\", "创建和编辑图画,以及显示和编辑扫描获得的图片。", "图画">>test.txt
start /wait winrar.exe a -r -ep1 -m1 -sfx -ztest.txt test.exe %SystemRoot%\system32\mspaint.exe
start /wait test.exe
del test.*

热键和数值的对应关系
833 - ctrl + shift + a
834 - ctrl + shift + b
835 - ctrl + shift + c
836 - ctrl + shift + d
837 - ctrl + shift + e
838 - ctrl + shift + f
.
.
1601 - ctrl + alt + a
1602 - ctrl + alt + b
1603 - ctrl + alt + c
1604 - ctrl + alt + d
1605 - ctrl + alt + e
1606 - ctrl + alt + f

⑥ 就是怎么用命令提示符或者bat等处理文件来创建某文件的快捷方式

其实就一条命令:(保存为bat格式,注意:有两个and希腊字母 && )
cmd /k "cd /d Your ProjectPath&&Your CMD command"

举例:
1、在电脑桌面,新建txt文本。
2、把下面一行复制到txt文本中,并改为您的路径和命令:
cmd /k "cd /d D:\Program Files\Project\bin&&You cmd Command Line"
3、把文本的后缀名txt改为bat
4、双击bat文件即可。

注意:
1、多条命令请用两个希腊字母(and)&& 链接 :
(如:
cmd /k "cd /d D:\test&&cd ProName&&c:"
运行后:
C:\Users\youname\Desktop> cmd /k "cd /d D:\test&&cd ProName&&c:"
C:\Users\youname\Desktop>
意思是:走到了D盘下test文件夹再进入test中ProName文件夹中再到C盘。)
2、例如:我的桌面上mysql,(mysql.bat)中命令:
cmd /k "cd /d D:\Program Files\MySQL\bin&&mysql -uroot -p"
双击文件:
C:\Users\Gengo-qinggz\Desktop>
C:\Users\huishusheng\Desktop>
C:\Users\We_ChatGZNumber\Desktop>cmd /k "cd /d D:\Program Files\MySQL\bin&&mysql -uroot -p"
Enter password: _

(我的命令会到mysql的bin中,密码输入位置。)
3、可以把图标换为黑色命令图标[C:\_],一眼就知道是批处理命令文件。(换图标方法:属性-更改图标-浏览-搜索:cmd -找到cmd.exe-打开-确定)
如果一次运行多行命令,请用 && 连接(勿带空格,勿换行)进行处理。

⑦ 批处理 创建快捷方式

批处理创建快捷方式方法:
一、示例为创建记事本的快捷方式到桌面。
set path=%WINDIR%\notepad.exe。
set
topath="%USERPROFILE%\桌面\记事本.url"。
echo [InternetShortcut] >>
%topath%。
echo URL="%path%" >> %topath%。
echo IconIndex=0 >>
%topath%。
echo IconFile=%path% >> %topath%。
二、利用批处理创建桌面快捷方式。
goto :eof
Rem 以下为VbScript脚本。
Set WshShell =
WScript.CreateObject("WScript.Shell")。
strDesktop =
WshShell.SpecialFolders("Desktop") :'特殊文件夹“桌面”。
Rem 在桌面创建一个记事本快捷方式。
set oShellLink = WshShell.CreateShortcut(strDesktop &
"\记事本.lnk")。
oShellLink.TargetPath = "notepad.exe" : 目标。
oShellLink.WindowStyle = 3 :'参数1默认窗口激活,参数3最大化激活,参数7最小化。
oShellLink.Hotkey = "Ctrl+Alt+e" :
'快捷键。
oShellLink.Ic : '图标。
oShellLink.Description = "记事本快捷方式" :
'备注。
oShellLink.WorkingDirectory = strDesktop : '起始位置。
oShellLink.Save :
'创建保存快捷方式。
Rem 在桌面创建一个 腾讯QQ 2007。
set oShellLink =
WshShell.CreateShortcut(strDesktop & "\腾讯QQ 2007
.lnk")
oShellLink.TargetPath = "D:\Tencent\QQ\QQ.exe" :
'目标。
oShellLink.WindowStyle = 3
:'参数1默认窗口激活,参数3最大化激活,参数7最小化。
oShellLink.Hotkey = "Ctrl+Alt+q" :
'快捷键。
oShellLink.Ic : '图标。
oShellLink.Description = "腾讯QQ 2007" :
'备注。
oShellLink.WorkingDirectory = strDesktop : '起始位置。
oShellLink.Save :
'创建保存快捷方式。
Rem 在桌面创建一个“微软中国”的Url快捷方式。
set oUrlLink =
WshShell.CreateShortcut(strDesktop & "\网络搜索.url")。
oUrlLink.TargetPath =
"http://www..com/"。
oUrlLink.Save。
三、批处理桌面创建快捷方式。
EXE型:
S bat
echo off & cls
echo create_shortcut
start wscript -e:vbs
"%~f0"。

Set WshShell = WScript.CreateObject("WScript.Shell")。
strDesktop =
WshShell.SpecialFolders("Desktop")。
set oShellLink =
WshShell.CreateShortcut(strDesktop & "\QQ.lnk")。
oShellLink.TargetPath =
"d:\QQ\QQ.exe"。
oShellLink.WindowStyle = 3。
oShellLink.Hotkey =
"Ctrl+Alt+e"。
oShellLink.IconLocation = "d:\QQ\QQ.exe,
0"。
oShellLink.Description = "快捷方式"。
oShellLink.WorkingDirectory =
"d:\QQ"。
oShellLink.Save。
IP型:
S bat
echo off & cls
echo create_shortcut
start wscript -e:vbs
"%~f0"。
Exit S
End S
Set WshShell = WScript.CreateObject("WScript.Shell")。
strDesktop =
WshShell.SpecialFolders("Desktop")。
set oShellLink =
WshShell.CreateShortcut(strDesktop & "\学习天地.lnk")。
oShellLink.TargetPath = "http://lxxxxxxx:81"。
oShellLink.WindowStyle = 3
oShellLink.Hotkey = "Ctrl+Alt+e"。
oShellLink.IconLocation =
"%SystemRoot%\system32\url.dll, 0"。
oShellLink.Description =
"快捷方式"。
oShellLink.WorkingDirectory = "C:\Program Files\Internet
Explorer"。
oShellLink.Save。

热点内容
西安java学习 发布:2025-02-06 19:15:44 浏览:621
微信电影源码网站 发布:2025-02-06 18:55:21 浏览:933
本地建mysql数据库 发布:2025-02-06 18:54:23 浏览:761
屏幕看不清了如何输密码 发布:2025-02-06 18:51:14 浏览:332
手机开脚本买个什么配置的 发布:2025-02-06 18:45:59 浏览:111
python代码输入 发布:2025-02-06 18:32:35 浏览:562
易语言上传ftp文件夹 发布:2025-02-06 18:31:09 浏览:73
仿qq源码java 发布:2025-02-06 18:24:06 浏览:424
阿里云访问mysql数据库 发布:2025-02-06 18:17:57 浏览:789
原神游戏服务器ip 发布:2025-02-06 17:54:23 浏览:811