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-10 20:57
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 请问将一个程序的快捷方式发送到桌面如何写批处理? How to write a batch script to send a shortcut of a program to the desktop? View 1,760 Replies 9
Original Poster Posted 2008-12-04 10:08 ·  中国 上海 电信
初级用户
Credits 37
Posts 36
Joined 2008-12-02 13:29
17-year member
UID 132662
Gender Male
Status Offline
Please help the big shot write a batch processing. The requirement is that when entering the system for the first time, delete C:\Documents and Settings\Administrator\Desktop\Tencent QQ, then send the shortcut of D:\Backup\QQ\QQ.exe to the desktop, then modify the shortcut to "Tencent QQ", and finally delete the batch processing itself.

Deleting the batch processing file itself can be done with del %0, but del C:\Documents and Settings\Administrator\Desktop\Tencent QQ is not okay, and it doesn't work with system variables. It's really frustrating. Also, sending the shortcut of D:\Backup\QQ\QQ.exe to the desktop is even more difficult. I hope the big shot will kindly give advice.

[ Last edited by cnds on 2008-12-4 at 10:13 ]
Floor 2 Posted 2008-12-04 11:19 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Are you going to replace QQ with a hacking software?
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
moniuming +1 2008-12-04 13:46
Floor 3 Posted 2008-12-04 11:31 ·  中国 上海 奉贤区 电信
初级用户
Credits 37
Posts 36
Joined 2008-12-02 13:29
17-year member
UID 132662
Gender Male
Status Offline
No, I encapsulated a system. QQ uses the YLMF-modified one. But after the system is installed, the QQ opened with that shortcut dies when moved and can't be used. But the shortcut sent with Tencent's QQ.exe is fine. So I want to make a batch file and add it to the GHO.
Floor 4 Posted 2008-12-04 12:04 ·  中国 安徽 马鞍山 联通
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
The following is what I used before. It can be referred to.

Function: Use shortcut.exe to create a "GGhost One - Click Recovery" shortcut on the desktop for gghost.exe in the specified directory (d:\ggho). The working directory is the specified directory.

set ggpath0=d:\ggho
%ggpath0%\tools\shortcut.exe /f:"%userprofile%"\Desktop\GGhost One - Click Recovery.lnk /a:c /w:%ggpath0%\ /t:%ggpath0%\gghost.exe >nul
Windows 一键还原
http://www.yjhy.com
Floor 5 Posted 2008-12-04 14:20 ·  中国 上海 电信
初级用户
Credits 37
Posts 36
Joined 2008-12-02 13:29
17-year member
UID 132662
Gender Male
Status Offline
I wrote 2 batch files a and b. Put b in the startup, and put a in %windir%. After starting b, it will execute a. But after a is executed, the program ends. According to the design, after a is executed, it should jump back to b to execute the remaining statements. But I don't know how to connect back to b. I don't know how to handle the system variable "C:\Documents and Settings\Administrator\「Start」Menu\Programs\Startup". Experts, please give guidance.

a:

Sub bat
echo off & cls
echo create_shortcut
start wscript -e:vbs "%~f0"
Exit Sub
End Sub


Set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\QQ.lnk")
oShellLink.TargetPath = "D:\backup\QQ.exe"
oShellLink.WindowStyle = 3
oShellLink.Hotkey = ""
oShellLink.IconLocation = "D:\backup\QQ.exe, 0"
oShellLink.Description = "Shortcut"
oShellLink.WorkingDirectory = "D:\backup\QQ.exe"
oShellLink.Save

b:

call %windir%\a.bat
del C:\Docume~1\Administrator\Desktop\Tencent QQ.lnk
ren C:\Docume~1\Administrator\Desktop\qq.lnk Tencent QQ.lnk
del %windir%\a.bat
del %0

a.bat is used to send the shortcut of d:\backup\qq\qq.exe to the desktop. This function has been realized. I tried to add call C:\Docume~1\Administrator\「Start」Menu\Programs\Startup\b.bat in a.bat to realize that after a.bat is executed, it jumps back to b.bat, but it prompts that there is a missing statement. Great expert, please help.

[ Last edited by cnds on 2008-12-4 at 14:23 ]
Floor 6 Posted 2008-12-04 17:53 ·  中国 上海 奉贤区 电信
初级用户
Credits 37
Posts 36
Joined 2008-12-02 13:29
17-year member
UID 132662
Gender Male
Status Offline
Just use this batch:
code:
Sub bat
echo off & cls
echo create_shortcut
start wscript -e:vbs "%~f0"
Exit Sub
End Sub

Set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\Tencent QQ.lnk")
oShellLink.TargetPath = "D:\backup\QQ.exe"
oShellLink.WindowStyle = 3
oShellLink.Hotkey = ""
oShellLink.IconLocation = "D:\backup\QQ.exe, 0"
oShellLink.Description = "Shortcut"
oShellLink.WorkingDirectory = "D:\backup\QQ.exe"
oShellLink.Save

The function is achieved, but I don't know how to delete itself. Experts, please give advice.

[ Last edited by cnds on 2008-12-4 at 17:55 ]
Floor 7 Posted 2008-12-04 17:57 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Can't you delete a inside b?
Floor 8 Posted 2008-12-04 20:39 ·  中国 上海 奉贤区 电信
初级用户
Credits 37
Posts 36
Joined 2008-12-02 13:29
17-year member
UID 132662
Gender Male
Status Offline
No, after running b.bat, execute call %windir%\a.bat, but after executing a.bat, the program cannot return to b.bat.
Floor 9 Posted 2008-12-04 21:34 ·  中国 新疆 石河子 电信
初级用户
Credits 50
Posts 25
Joined 2007-03-29 14:07
19-year member
UID 83301
Gender Male
Status Offline
I think the simplest way is that you make a shortcut in advance and copy it over.
Floor 10 Posted 2008-12-04 21:38 ·  中国 上海 奉贤区 电信
初级用户
Credits 37
Posts 36
Joined 2008-12-02 13:29
17-year member
UID 132662
Gender Male
Status Offline
Establishing shortcuts is the root of the problem. As long as this is achieved, other things are relatively easier to solve.
Forum Jump: