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-07-24 14:00
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to create a shortcut for a certain software using cmd? View 2,581 Replies 8
Original Poster Posted 2006-05-10 17:46 ·  中国 广东 汕头 电信
初级用户
Credits 108
Posts 38
Joined 2006-05-07 10:16
20-year member
UID 55078
Status Offline
How to create a shortcut using commands in Windows XP?
Floor 2 Posted 2006-05-10 17:55 ·  中国 山东 济南 移动
钻石会员
★★★★★
Credits 10,051
Posts 3,040
Joined 2002-11-11 00:00
23-year member
UID 223
Gender Male
Status Offline
Internet shortcuts are in text format, you can refer to it.


───────────────── Moderator's Note ─────────────────
For the implementation of this solution, there are the following examples. Please refer to for details.
Example 1:

echo >>a.url
echo URL=c:\windows\system32\notepad.exe >>a.url
echo IconIndex=29 >>a.url
echo IconFile=C:\windows\system32\shell32.dll >>a.url


Example 2:

@echo off
if exist "%1.url" echo The link "%1.url" has been created! & goto :eof
if exist "%~f2" echo The target "%~f2" does not exist! & goto :eof
echo > "%1.URL"
echo URL=%~f2 >> "%1.URL"
echo IconIndex=0 >> "%1.URL"
echo IconFile=%~f2 >> "%1.URL"

How to create a shortcut with batch processing?
http://www.cn-dos.net/forum/viewthread.php?tid=20183
───────────────── Moderator's Note ─────────────────


[ Last edited by willsort on 2006-5-11 at 17:46 ]
简单就是美
Floor 3 Posted 2006-05-10 20:09 ·  中国 上海 电信
中级用户
★★
大师兄
Credits 377
Posts 99
Joined 2005-08-26 07:37
20-year member
UID 41945
Status Offline
There is no command in Windows XP specifically for doing this. You can use other tools.
1. There is a command called shortcut.exe in Windows 95 or Nt 4.0 Resource Kit. (Recommended)
2. Third - party Shortcut.exe
3. Use vbs
-------------------------------------------------------------------------------------------
Dim WSHShell, fs
Set WSHShell = WScript.CreateObject("WScript.Shell")
Set fs = WScript.CreateObject("Scripting.FileSystemObject")
Function MakeDesktopShortcut( name, target )
Dim Shortcut,DesktopPath,StartupPath
DesktopPath = WSHShell.SpecialFolders("Desktop")
Set Shortcut = WSHShell.CreateShortcut(DesktopPath & "\" & name & ".lnk")
Shortcut.TargetPath = target
StartupPath = fs.GetParentFolderName( target )
If fs.FolderExists( StartupPath ) then
Shortcut.WorkingDirectory = StartupPath
End If
Shortcut.Save
End Function

MakeDesktopShortcut "Shortcut to Notepad", "C:\Windows\Notepad.exe"
--------------------------------------------------------------------------------------------
Floor 4 Posted 2006-05-10 20:43 ·  中国 湖北 荆门 电信
荣誉版主
★★★
Credits 2,013
Posts 718
Joined 2006-02-18 07:07
20-year member
UID 50550
Status Offline
You can refer to (url=http://www.cn-dos.net/forum/viewthread.php?tid=20183&fpage=1&highlight=%E5%BF%AB%E6%8D%B7%E6%96%B9%E5%BC%8F%2B3742668) or refer to the vbs method upstairs, and give a comment:

set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop") 'Get the desktop directory
set oShellLink = WshShell.CreateShortcut(strDesktop & "\qq.lnk") 'Shortcut storage directory and name
oShellLink.TargetPath = "C:\Program Files\Tencent\QQ\CoralQQ.exe" 'Target executable file
oShellLink.WindowStyle = 1 'Run mode
oShellLink.Hotkey = "CTRL+SHIFT+F" 'Hotkey
oShellLink.IconLocation = "C:\Program Files\Tencent\QQ\QQ.exe, 0" 'Icon
oShellLink.Description = "qq" 'Remark
oShellLink.WorkingDirectory = "C:\Program Files\Tencent\QQ\" 'Start directory
oShellLink.Save 'Create shortcut
Floor 5 Posted 2006-05-10 22:24 ·  中国 四川 成都 联通
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
You can try this under XP:


fsutil file createnew C:\test 0
rundll32.exe appwiz.cpl,NewLinkHere C:\test


The system will prompt to create a shortcut under C:\

[ Last edited by electronixtar on 2006-5-10 at 22:32 ]
Floor 6 Posted 2006-07-24 19:39 ·  中国 河南 焦作 博爱县 联通
新手上路
Credits 2
Posts 1
Joined 2006-07-24 18:52
19-year member
UID 59162
Status Offline
How to create a shortcut to the "c:\setups" folder in sendto and add it to the right-click "Send to"?
Floor 7 Posted 2006-12-19 20:26 ·  中国 广东 东莞 电信
初级用户
Credits 31
Posts 16
Joined 2006-12-19 15:55
19-year member
UID 73967
Gender Male
Status Offline
Small tip, maybe it will help me a lot in the future
Floor 8 Posted 2006-12-20 08:03 ·  中国 安徽 芜湖 电信
高级用户
★★★
Credits 906
Posts 346
Joined 2006-07-10 09:58
20-year member
UID 58334
Gender Male
Status Offline
Originally posted by dst1213 at 2006-7-24 19:39:
How to create a shortcut to the "c:\setups" folder in sendto and add it to the right-click "Send To"?

Just put it in that folder
Floor 9 Posted 2006-12-20 08:11 ·  中国 广东 深圳 电信
初级用户
★★
Credits 135
Posts 64
Joined 2006-12-20 04:35
19-year member
UID 74003
Gender Male
Status Offline
Bump
Forum Jump: