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 16:59
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to create a shortcut using batch processing? View 6,178 Replies 16
Original Poster Posted 2006-04-19 20:33 ·  中国 广东 广州 天河区 电信
初级用户
Credits 100
Posts 34
Joined 2006-04-05 05:13
20-year member
UID 53340
Gender Male
Status Offline
Dear brothers:
Suppose under the WINXP system, to create a shortcut for D:\prog\abc.exe, and save it in the c:\prg directory, how to achieve?
Thank you in advance
Floor 2 Posted 2006-04-19 21:21 ·  中国 湖北 荆门 电信
荣誉版主
★★★
Credits 2,013
Posts 718
Joined 2006-02-18 07:07
20-year member
UID 50550
Status Offline

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

A makeshift method. This shortcut is different from the one created by right-clicking and selecting "Send to Desktop Shortcut".
If you want to create that kind, you can consider using VBS.
IconFile specifies the icon file used by the shortcut.
IconIndex specifies which icon in the icon file the shortcut uses.
URL specifies the executable file that the shortcut points to.
Floor 3 Posted 2006-04-20 11:05 ·  中国 广东 广州 天河区 电信
初级用户
Credits 100
Posts 34
Joined 2006-04-05 05:13
20-year member
UID 53340
Gender Male
Status Offline
Brother upstairs:

Thank you!

The problem has been solved to a large extent, thank you very much! Below is the code I have slightly modified, please correct it! Although it can't be said to solve the problem 100%, it has basically been solved, thank you
@echo off
set /p filename=please input:
echo [InternetShortcut] >>%filename%
echo URL=c:\windows\system32\notepad.exe >>%filename%
echo IconIndex=1 >>%filename%
echo IconFile=C:\windows\system32\shell32.dll >>%filename%
Floor 4 Posted 2006-04-20 17:02 ·  中国 湖北 武汉 电信
新手上路
Credits 4
Posts 2
Joined 2006-04-20 15:54
20-year member
UID 54145
Status Offline
I made a command based on the method of the great expert upstairs. Let's see what you think:

@ECHO OFF

ECHO > %1.URL
ECHO URL=%2 >> %1.URL
ECHO IconIndex=0 >> %1.URL
ECHO IconFile=%2 >> %1.URL

@ECHO ON

[ Last edited by WisdomNil on 2006-4-20 at 17:03 ]
Floor 5 Posted 2006-04-25 03:19 ·  中国 河南 郑州 电信
中级用户
Credits 207
Posts 41
Joined 2004-10-24 00:00
21-year member
UID 32885
Gender Male
Status Offline
Well, that's pretty good. Studying hard...
Floor 6 Posted 2006-05-13 18:44 ·  中国 广东 东莞 电信
初级用户
★★
Credits 118
Posts 66
Joined 2005-10-21 03:27
20-year member
UID 43827
Status Offline
Floor 7 Posted 2006-05-14 19:54 ·  中国 四川 成都 联通
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Can it be output as lnk? Lnk is in binary format. I guess some dll in the system can be used with rundll32 to create lnk
Floor 8 Posted 2006-05-14 23:15 ·  中国 湖北 荆门 电信
荣誉版主
★★★
Credits 2,013
Posts 718
Joined 2006-02-18 07:07
20-year member
UID 50550
Status Offline

Can it be output as lnk? Lnk is in binary format. I guess some dll in the system should be able to use rundll32 to create lnk.

Using rundll32 requires interaction.
Using vbs is okay. In XP, using wmic seems to be able to achieve it as well.
Floor 9 Posted 2006-10-18 04:24 ·  中国 四川 南充 电信
超级版主
★★★★
我爱DOS
Credits 5,310
Posts 2,044
Joined 2005-09-26 12:00
20-year member
UID 42843
Gender Male
From 四川南充
Status Offline
Why can't I implement this shortcut function in Windows 2000? After setting it up, clicking this shortcut requires me to establish a file association!
Floor 10 Posted 2006-10-18 05:21 ·  中国 四川 成都 教育网
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Only now do I realize that VBS can create shortcuts, oh my!

Well, there are 7 types of shortcuts in Vista, heh

Back then, I really knew nothing at all. I learned a lot from the union website, thanks to all forum members~

[ Last edited by electronixtar on 2006-10-18 at 05:33 ]

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
Floor 11 Posted 2006-12-20 08:09 ·  中国 广东 深圳 电信
初级用户
★★
Credits 135
Posts 64
Joined 2006-12-20 04:35
19-year member
UID 74003
Gender Male
Status Offline
Everyone here are all experts!
Floor 12 Posted 2006-12-20 10:54 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline

  Ask the moderator, how to create a shortcut under XP using WMIC?
Floor 13 Posted 2006-12-21 03:16 ·  中国 河北 石家庄 联通
中级用户
Credits 205
Posts 32
Joined 2004-02-06 00:00
22-year member
UID 16828
Gender Female
Status Offline
I tried it. When I added the .lnk suffix when entering the file name, a shortcut appeared, but double-clicking it didn't execute the linked file!
I was testing in the command line mode of XP!
Floor 14 Posted 2006-12-21 08:56 ·  中国 黑龙江 佳木斯 电信
新手上路
Credits 6
Posts 3
Joined 2006-12-20 12:44
19-year member
UID 74047
Gender Male
Status Offline
Floor 15 Posted 2006-12-22 01:36 ·  中国 广东 深圳 福田区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
I am creating a shortcut using winrar :-)
@echo off
echo Path=%%SystemRoot%%\system32\>test.txt
echo Silent=^2>>test.txt
echo Overwrite=^1>>test.txt
echo Shortcut=D, "mspaint.exe", "\", "Create and edit pictures, as well as display and edit scanned pictures.", "Paint">>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.*
第一高手 第二高手

Forum Jump: