中国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-11 00:56
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » Four ways to create shortcuts with batch processing
Printable Version  2,334 / 8
Floor1 tr0217 Posted 2008-11-12 16:26
初级用户 Posts 23 Credits 40
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
Floor2 tireless Posted 2008-11-12 22:08
银牌会员 Posts 1,122 Credits 2,025
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.
Floor3 slore Posted 2008-11-12 22:29
铂金会员 Posts 2,478 Credits 5,212
VBS...

Shortcut.Description = "I am a shortcut"
Floor4 langzi900 Posted 2008-11-12 23:00
新手上路 Posts 8 Credits 8
Good stuff ah
Learn about it
Floor5 tr0217 Posted 2008-11-17 12:56
初级用户 Posts 23 Credits 40
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
Floor6 HAT Posted 2008-11-17 13:23
版主 Posts 5,017 Credits 9,023
First, read the help documentation of rar.exe several times, and ask questions when encountering specific problems.
Floor7 hhasee Posted 2009-02-02 15:26
初级用户 Posts 88 Credits 185
Great! Thank you, the thread starter, you've been a great help to me!
Floor8 samliu Posted 2009-02-05 21:52
新手上路 Posts 15 Credits 15
Have been wanting to find the method of creating shortcuts using commands. Finally saw it, and there are still many kinds. Thanks,楼主. Learned it.
Floor9 raythunder Posted 2009-02-09 15:13
初级用户 Posts 30 Credits 47
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.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023