中国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-10 19:52
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » 请问将一个程序的快捷方式发送到桌面如何写批处理? How to write a batch script to send a shortcut of a program to the desktop?
Printable Version  1,758 / 9
Floor1 cnds Posted 2008-12-04 10:08
初级用户 Posts 36 Credits 37
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 ]
Floor2 HAT Posted 2008-12-04 11:19
版主 Posts 5,017 Credits 9,023
Are you going to replace QQ with a hacking software?
Floor3 cnds Posted 2008-12-04 11:31
初级用户 Posts 36 Credits 37
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.
Floor4 lianjiang2004 Posted 2008-12-04 12:04
金牌会员 Posts 1,884 Credits 3,946
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
Floor5 cnds Posted 2008-12-04 14:20
初级用户 Posts 36 Credits 37
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 ]
Floor6 cnds Posted 2008-12-04 17:53
初级用户 Posts 36 Credits 37
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 ]
Floor7 HAT Posted 2008-12-04 17:57
版主 Posts 5,017 Credits 9,023
Can't you delete a inside b?
Floor8 cnds Posted 2008-12-04 20:39
初级用户 Posts 36 Credits 37
No, after running b.bat, execute call %windir%\a.bat, but after executing a.bat, the program cannot return to b.bat.
Floor9 wuxj Posted 2008-12-04 21:34
初级用户 Posts 25 Credits 50
I think the simplest way is that you make a shortcut in advance and copy it over.
Floor10 cnds Posted 2008-12-04 21:38
初级用户 Posts 36 Credits 37
Establishing shortcuts is the root of the problem. As long as this is achieved, other things are relatively easier to solve.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023