|
:Link
::创建快捷方式所在文件夹
mkdir "C:\ProgramData\Microsoft\Windows\Start Menu\Program Files"
::设置程序或文件的路径(必选)
set Program=%~dp0CPix.exe
::设置启动参数(可选)
set Arguments=
::设置快捷方式名称(必选)
set LnkName=CPix
::设置程序的工作路径,一般为程序主目录,此项若留空,脚本将自行分析路径
set WorkDir=
::图标
set Desc=%~dp0CPix.exe, 1
if not defined WorkDir call:GetWorkDir "%Program%"
(echo Set WshShell = WScript.CreateObject("WScript.Shell"^)
::快捷方式路径
echo set oShellLink = WshShell.CreateShortcut("C:\ProgramData\Microsoft\Windows\Start Menu\Program Files\%LnkName%.lnk"^)
echo oShellLink.TargetPath="%Program%"
echo oShellLink.WorkingDirectory="%WorkDir%"
echo oShellLink.WindowStyle=1
echo oShellLink.Description="%Desc%"
echo oShellLink.Save)>makelnk.vbs
echo 创建保存快捷方式
makelnk.vbs
del /f /q makelnk.vbs
exit
goto :eof
:GetWorkDir
set WorkDir=%~dp1
set WorkDir=%WorkDir:~,-1%
goto :eof |
|