add_func:创建快捷方式

This commit is contained in:
fengbohan 2023-08-16 17:30:00 +08:00
parent 8012d3a07e
commit dcfcc0dae1
3 changed files with 62 additions and 1 deletions

View File

@ -8,7 +8,7 @@
## 待添加功能
* [ ]
* [ ] 下周一也可以运行
## 运行程序
@ -26,3 +26,7 @@ new file name: 2023WW33周工作报告_冯博涵.doc;
pre_str: 8.7~8.11
str: 8.14~8.18
```
## 注意
1. `创建桌面快捷方式.bat`该文件是 `GBK`编码。

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -0,0 +1,57 @@
chcp 936
REM 设置936编码防止某些中文路径导致批处理失效
@echo off
setlocal enabledelayedexpansion
mode con cols=94 lines=30&color 0a&title 创建桌面快捷方式
echo.
echo [+] 获得当前路径:%~dp0
set path=%~dp0auto_run_python.bat
echo.
if exist %path% (
echo [+] 发现脚本auto_run_python.bat
echo.
echo [+] 启动脚本路径:
echo.
echo [+] %path%
echo.
goto :creat
) else (
echo [-] 注意,未发现启动脚本发现脚本auto_run_python.bat,请注意是否改名,程序退出...
echo.
pause
exit
)
:creat
echo [+] 开始创建快捷方式...
echo.
rem 设置程序的完整路径(必要)
set Program=%path%
rem 设置快捷方式名字(必要)
set LinkName=写周报了
rem 程序工作路径
set WorkDir=%~dp0
rem 设置快捷方式说明
set Desc=写周报了
rem 设置快捷方式图标
set icon=%~dp0/favicon.ico
if not defined WorkDir call:GetWorkDir "%Program%"
(echo Set WshShell=CreateObject("WScript.Shell"^)
echo strDesKtop=WshShell.SpecialFolders("DesKtop"^)
echo Set oShellLink=WshShell.CreateShortcut(strDesKtop^&"\%LinkName%.lnk"^)
echo oShellLink.TargetPath="%Program%"
echo oShellLink.WorkingDirectory="%WorkDir%"
echo oShellLink.WindowStyle=1
echo oShellLink.Description="%Desc%"
echo oShellLink.IconLocation="%icon%"
echo oShellLink.Save)>makelnk.vbs
echo [+] 桌面快捷方式创建成功!!
echo.
makelnk.vbs
del /f /q makelnk.vbs
pause
goto :eof
:GetWorkDir
set WorkDir=%~dp1
set WorkDir=%WorkDir:~,-1%
pause
goto :eof