Microsoft, Other

BTA creates application shortcuts

2021年7月25日

@echo off

::Set the full path of the program or file (required)
set Program=%cd%\Line.exe
   
::Set shortcut name (required)
set LnkName=Line
 
::Set the working path of the program, usually the main directory of the program, if this item is left blank, the script will analyze the path by itself
set WorkDir=%cd%
 
::Set the description of the shortcut display (optional)
set Desc=Line
 
if not defined WorkDir call:GetWorkDir "%Program%"
(echo Set WshShell=CreateObject("WScript.Shell"^)
echo strDesKtop=WshShell.SpecialFolders("DesKtop"^)
echo Set oShellLink=WshShell.CreateShortcut(strDesKtop^&"\%LnkName%.lnk"^)
echo oShellLink.TargetPath="%Program%"
echo oShellLink.WorkingDirectory="%WorkDir%"
echo oShellLink.WindowStyle=1
echo oShellLink.Description="%Desc%"
echo oShellLink.Save)>makelnk.vbs
echo The desktop shortcut was created successfully! 
makelnk.vbs
del /f /q makelnk.vbs
exit
goto :eof
:GetWorkDir
set WorkDir=%~dp1
set WorkDir=%WorkDir:~,-1%
goto :eof

You Might Also Like

No Comments

Leave a Reply

%d 博主赞过: