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-11 00:10
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Four ways to create shortcuts with batch processing View 2,332 Replies 8
Original Poster Posted 2008-11-12 16:26 ·  中国 陕西 西安 长安区 电信
初级用户
Credits 40
Posts 23
Joined 2008-11-06 16:40
17-year member
UID 130180
Gender Male
Status Offline
Method 1, URL-style shortcut
echo [InternetShortcut] >>"%USERPROFILE%\Desktop\Paint.url"
echo URL="%SystemRoot%\system32\mspaint.exe" >>"%USERPROFILE%\Desktop\Paint.url"
echo IconIndex=0 >>"%USERPROFILE%\Desktop\Paint.url"
echo IconFile="%SystemRoot%\system32\mspaint.exe" >>"%USERPROFILE%\Desktop\Paint.url"

This method will, on most computers, present a prompt that it can't create file associations and end up doing nothing.
Hope experts can add code to add a description to the shortcut

Method 2, external command
shortcut.exe /f:"%USERPROFILE%\Desktop\Paint.lnk" /a:c /t:"%SystemRoot%\system32\mspaint.exe"
shutcut can be downloaded on this forum. Also hope experts can add code to add a description to the shortcut


Method 3, VBScript script
@echo
set shortCutPath="%USERPROFILE%\Desktop\Paint.lnk"
echo Dim WshShell,Shortcut>>tmp.vbs
echo Dim path,fso>>tmp.vbs
echo path="%SystemRoot%\system32\mspaint.exe">>tmp.vbs
echo Set fso=CreateObject("Scripting.FileSystemObject")>>tmp.vbs
echo Set WshShell=WScript.CreateObject("WScript.Shell")>>tmp.vbs
echo Set Shortcut=WshShell.CreateShortCut(%shortCutPath%)>>tmp.vbs
echo Shortcut.TargetPath=path>>tmp.vbs
echo Shortcut.Save>>tmp.vbs
"%SystemRoot%\System32\WScript.exe" tmp.vbs
@del /f /s /q tmp.vbs
pause

This method also hopes experts can add code to add a description to the shortcut


Method 4, 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.*
I don't quite understand the last two sentences of this method. Hope to get an explanation

Correspondence between hotkeys and values
833 - Ctrl + Shift + A
834 - Ctrl + Shift + B
835 - Ctrl + Shift + C
836 - Ctrl + Shift + D
837 - Ctrl + Shift + E
838 - Ctrl + Shift + F
.
.
1601 - Ctrl + Alt + A
1602 - Ctrl + Alt + B
1603 - Ctrl + Alt + C
1604 - Ctrl + Alt + D
1605 - Ctrl + Alt + E
1606 - Ctrl + Alt + F
Recent Ratings for This Post ( 2 in total) Click for details
RaterScoreTime
pusofalse +11 2008-11-12 22:04
Pierre +1 2009-04-04 04:01
Floor 2 Posted 2008-11-12 22:08 ·  中国 江西 赣州 电信
银牌会员
★★★★
Credits 2,025
Posts 1,122
Joined 2007-09-05 20:15
18-year member
UID 96653
Gender Male
Status Offline
The .url shortcut doesn't seem to be able to set "description".

the url format
http://www.moon-soft.com/program/FORMAT/internet/url.htm

————————————————————————————————————————

shortcut.exe /?

————————————————————————————————————————

Method four, winrar
... ...
start /wait test.exe
del test.*
I don't quite understand these last two sentences, hope experts can explain

These two sentences?
C:\>start /?
Start another window to run the specified program or command.

START




"title" The title displayed in the window title bar
path Start directory
B Start the application without creating a new window. Unless
Start ^C processing, otherwise the application will ignore ^C processing;
^Break is the only way to interrupt the application
I The new environment is the original environment passed to cmd.exe,
rather than the current environment
MIN Start the window minimized at the beginning
MAX Start the window maximized at the beginning
SEPARATE Start 16-bit Windows programs in separate spaces
SHARED Start 16-bit Windows programs in shared spaces
LOW Start the application in IDLE priority category
NORMAL Start the application in NORMAL priority category
HIGH Start the application in HIGH priority category
REALTIME Start the application in REALTIME priority category
ABOVENORMAL Start the application in ABOVENORMAL priority category
BELOWNORMAL Start the application in BELOWNORMAL priority category
WAIT Start the application and wait for it to end

del test.* -- Delete all files with the filename test.
Floor 3 Posted 2008-11-12 22:29 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
VBS...

Shortcut.Description = "I am a shortcut"
S smile 微笑,L love 爱,O optimism 乐观,R relax 放松,E enthusiasm 热情...Slore
Floor 4 Posted 2008-11-12 23:00 ·  中国 辽宁 大连 电信
新手上路
Credits 8
Posts 8
Joined 2008-06-21 17:12
18-year member
UID 120679
Gender Male
Status Offline
Good stuff ah
Learn about it
Floor 5 Posted 2008-11-17 12:56 ·  中国 陕西 西安 长安区 电信
初级用户
Credits 40
Posts 23
Joined 2008-11-06 16:40
17-year member
UID 130180
Gender Male
Status Offline
Method 4, winrar
... ...
start /wait test.exe
del test.*
I don't quite understand the last two sentences, hope a master can explain


These two sentences?

I made a mistake, it's the last two or three sentences. It would be nice if you could explain the third last sentence
Floor 6 Posted 2008-11-17 13:23 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
First, read the help documentation of rar.exe several times, and ask questions when encountering specific problems.
Floor 7 Posted 2009-02-02 15:26 ·  中国 广东 深圳 电信
初级用户
★★
Credits 185
Posts 88
Joined 2008-05-12 18:46
18-year member
UID 118511
Gender Male
Status Offline
Great! Thank you, the thread starter, you've been a great help to me!
Floor 8 Posted 2009-02-05 21:52 ·  中国 黑龙江 哈尔滨 电信
新手上路
Credits 15
Posts 15
Joined 2009-01-24 10:46
17-year member
UID 137352
Gender Male
Status Offline
Have been wanting to find the method of creating shortcuts using commands. Finally saw it, and there are still many kinds. Thanks,楼主. Learned it.
Floor 9 Posted 2009-02-09 15:13 ·  中国 湖南 长沙 电信
初级用户
Credits 47
Posts 30
Joined 2007-12-18 18:03
18-year member
UID 106058
Gender Male
Status Offline
There is also a very useful external tool, which is the commonly used .PECMD.exe in the PE system. Double-click it directly to open its help. Follow the prompts to generate a shortcut in the command line.
Forum Jump: