中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-08 04:39
48,041 topics / 350,128 posts / today 3 new / 48,253 members
DOS批处理 & 脚本技术(批处理室) » How to add a "Send to Desktop Shortcut" right-click
Printable Version  3,872 / 6
Floor1 tireless Posted 2008-04-14 21:23
银牌会员 Posts 1,122 Credits 2,025
The "Send To" in the system is really unbearable. It takes a few seconds to display the Send To menu.

I want to add a menu in the right-click - Send To Desktop Shortcut.
· If it is a file, the created shortcut should preferably not have an extension.
· Can be for multiple files.
· It is best not to flash the cmd window.
· It is also okay to use other tools, such as shortcut, nircmd.
Floor2 slore Posted 2008-04-15 03:07
铂金会员 Posts 2,478 Credits 5,212
Quoted parts don't count as my words~郁闷~~~Spaces don't work either...


'-----------------DesktopLink.vbs---By Slore At 2008-04-15------------------
'
'脚本说明:
'Place it in any directory and double-click to install/uninstall.
'Welcome your testing and provide valuable feedback.
'If you like it, feel free to repost, but do not modify it casually.
' http://bbs.cn-dos.net
'
'意见反馈:1.论坛消息
' 2.email:slorelee@yahoo.com.cn
'---------------------------------------------------------Please keep me when reposting----
Dim strArg,strDesktop,strBsname
Set objShell = WScript.CreateObject("WScript.Shell")
ArgCount = wscript.Arguments.Count
If ArgCount = 0 Then
strArg = "Add a 'Send to Desktop Shortcut' option to the right-click:" & vbCrLf
ret = MsgBox( strArg & " Yes No Cancel",67,"By Slore")
strArg = "HKCR\AllFilesystemObjects\Shell\Slore\"
If ret = 6 Then
strCommand = "Wscript.exe """ & WScript.ScriptFullName & """ ""%1"""
objShell.RegWrite strArg,"Desktop Shortcut(&L)"
objShell.RegWrite strArg & "Command\", strCommand
MsgBox "Menu added successfully!..o(∩_∩)o..",64,"By Slore"
ElseIf ret = 7 Then
objShell.RegDelete strArg & "Command\"
objShell.RegDelete strArg
MsgBox "This menu has been deleted!",64,"By Slore"
End If
wscript.Quit
End If

Set
objFSO = CreateObject("Scripting.FileSystemObject")
strDesktop = objShell.SpecialFolders("Desktop")
For i = 0 To ArgCount - 1
strArg = wscript.arguments.item(i)
strBsname = objFSO.GetBaseName(strArg)
strTarget = strDesktop & "\" & strBsname
If Not CST(strTarget,".lnk") Then CST strTarget,".pif"
Next

Function
CST(strPath,strExt)
n = 1:CST = True
on Error Resume Next
Do While
objFSO.FileExists(strPath & strExt)
n = n + 1
strTarget = strDesktop & "\" & strBsname & " (" & n & ")"
Loop
Set oShellLink = objShell.CreateShortcut(strPath & ".lnk")
oShellLink.TargetPath = strArg
oShellLink.WorkingDirectory = objFSO.GetParentFolderName(strArg)
oShellLink.Save
if Err Then Err.Clear:CST = False
End Function

Set
oShellLink = Nothing
Set
objShell = Nothing
Set
objFSO = Nothing
Floor3 tireless Posted 2008-04-15 08:11
银牌会员 Posts 1,122 Credits 2,025
Thanks slore, it's very good. It's just that creating multiple shortcuts is a bit slow. It would be nice if it could be as fast as the system's.
Floor4 zh159 Posted 2008-04-15 09:48
金牌会员 Posts 1,467 Credits 3,687
The user on floor 2 can create multiple shortcuts after selecting multiple files.

[ Last edited by zh159 on 2008-4-15 at 09:53 AM ]
Floor5 slore Posted 2008-04-15 12:48
铂金会员 Posts 2,478 Credits 5,212
Originally posted by tireless at 2008-4-15 08:11:
Thanks slore, it's very good. Just creating multiple shortcuts is a bit slow, it would be nice if it was as fast as the system one


Already tried my best. But still lack knowledge...
Calling the system's that DESKLINK, but it's CLSID kind...
Actually selecting multiple, there's no loop entered...

It's calling DESKLINK.VBS for each file, so... the more selected, the slower it gets, will run n wscript... at once


So if it's multiple, just use SENDTO ~~

PS: SENDTO shows very fast here~~~ Is there too many items in yours?
Floor6 tireless Posted 2008-04-15 20:35
银牌会员 Posts 1,122 Credits 2,025
Originally posted by slore at 2008-4-14 04:48 PM:


PS: The SENDTO here shows very quickly~~~ Is it that you have too many items inside?


No, even if only leaving a "Desktop Shortcut", the display speed of that menu still makes me very depressed...

How to use shortcut or nircmd? It should be relatively fast.
Floor7 sylovanas Posted 2008-04-15 20:57
初级用户 Posts 42 Credits 107
1.bat content

@echo off
if exist %temp%\1.txt del 1.txt /q >nul 2>nul
for %%a in (%*) do echo shortcut "%%~a" "~$folder.desktop$" "%%~na">>%Temp%\1.txt
nircmd script %temp%\1.txt

Content to add to the right-click menu

nircmd execmd 1.bat %*

[ Last edited by sylovanas on 2008-4-15 at 09:00 PM ]
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023