windows 环境 通过bat+vbs脚本 自动上传typora笔记 到gitee/github的方法
https://www.bilibili.com/video/BV12K4y1g7Nf?share_source=copy_web
test.bat
@echo off
@title Typora_script
set /a timemax=5
set /a timemin=3
set /a timeval=%timemin%
:loop
echo LOOP_BEGIN[%time%]:%timeval%====== >> logfile.log
tasklist /nh|find /i "Typora.exe"
if ERRORLEVEL 1 (
echo exe_no_run >> logfile.log
set /a timeval+=2
if %timeval% GEQ %timemax% (set /a timeval=%timemax% )
)^
else (
echo exe_running >> logfile.log
set /a timeval=%timemin%
git add *
(git commit -m "%date%") | find /i "nothing to commit"
if ERRORLEVEL 1 (
echo "there are changes, push it to origin" >> logfile.log
git push -u origin master
)^
else (
echo "nothing to commit" >> logfile.log
)
)
timeout /nobreak /t %timeval%
goto loop
try.vbs
path= "D:\Program Files\typroa_file\tes.bat"
true_path = Chr(34) & path & Chr(34)
set ws=WScript.CreateObject("WScript.Shell")
ws.Run true_path,1,True