China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-08 03:32
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to add a "Send to Desktop Shortcut" right-click View 3,870 Replies 6
Original Poster Posted 2008-04-14 21:23 ·  中国 江西 赣州 安远县 电信
银牌会员
★★★★
Credits 2,025
Posts 1,122
Joined 2007-09-05 20:15
18-year member
UID 96653
Gender Male
Status Offline
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.
Floor 2 Posted 2008-04-15 03:07 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
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
Floor 3 Posted 2008-04-15 08:11 ·  中国 江西 赣州 安远县 电信
银牌会员
★★★★
Credits 2,025
Posts 1,122
Joined 2007-09-05 20:15
18-year member
UID 96653
Gender Male
Status Offline
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.
Floor 4 Posted 2008-04-15 09:48 ·  中国 广西 玉林 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
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 ]
Floor 5 Posted 2008-04-15 12:48 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
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?
Floor 6 Posted 2008-04-15 20:35 ·  中国 江西 赣州 电信
银牌会员
★★★★
Credits 2,025
Posts 1,122
Joined 2007-09-05 20:15
18-year member
UID 96653
Gender Male
Status Offline
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.
Floor 7 Posted 2008-04-15 20:57 ·  中国 台湾 中华电信
初级用户
Credits 107
Posts 42
Joined 2007-09-03 16:43
18-year member
UID 96475
Gender Male
Status Offline
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 ]
Forum Jump: