用批处理能不能创建文件夹的快捷方式到桌面
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
用批处理能不能创建文件夹的快捷方式到桌面?
好像不能,不过可以利用dos批处理,巧妙调用vbs脚本来实现:
[code]
cd.>tmp.vbs
for /f "usebackq skip=4 tokens=*" %%a in (%0) do
@echo %%a>>tmp.vbs
tmp.vbs&del tmp.vbs /q
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.IconLocation = "notepad.exe, 0" : '图标
oShellLink.Description = "记事本快捷方式" : '备注
oShellLink.WorkingDirectory = strDesktop : '起始位置
oShellLink.Save : '创建保存快捷方式
Rem 在桌面创建一个“微软中国”的Url快捷方式
set oUrlLink = WshShell.CreateShortcut(strDesktop & "\微软中
国.url")
oUrlLink.TargetPath = "/china"
oUrlLink.Save
[/code]
用上述代码创建一个批处理文件并运行,即可创建快捷方式(巧妙调
用了vbs脚本语言)
echo [InternetShortcut] > "%userprofile%\桌面\文件夹.url" echo URL=file:///C:/windows >> "%userprofile%\桌面\文件夹.url"
[quote]原帖由[i]cjzzz[/i] 于2007-1-29 05:50 PM 发表[url=/redirect.php?goto=findpost&pid=9566
52&ptid=91928][img]/images/common/back
.gif[/img][/url]
echo > "%userprofile%\桌面\文件夹.url"
echo URL=file:///C:/windows >> "%userprofile%\桌面\文件夹.url"
[/quote]
可以的,好.
cd.>tmp.vbs
for /f "usebackq skip=4 tokens=*" %%a in (%0) do @echo %%a>>tmp.vbs
tmp.vbs&del tmp.vbs /q
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.IconLocation = "notepad.exe, 0" : '图标oShellLink.Description = "记事本快捷方式" : '备注oShellLink.WorkingDirectory = strDesktop : '起始位置oShellLink.Save : '创建保存快捷方式
Rem 在桌面创建一个“微软中国”的Url快捷方式
set oUrlLink = WshShell.CreateShortcut(strDesktop & "\微软中国.url")
oUrlLink.TargetPath = "/china" oUrlLink.Save
用上述代码创建一个批处理文件并运行,即可创建快捷方式(巧妙调用了vbs脚本语言)