bat脚本自动上传/本地部署hexo

本地部署

1
2
3
4
5
6
7
8
9
10
11
12
13
@echo off

set d=%date:~0,10%
set t=%time:~0,8%

echo ==============cutting line============== >> "D:\lanbo\laptype.io\auto_git\commit.txt"
echo %d% %t% auto commit start... >> "D:\lanbo\laptype.io\auto_git\commit.txt"
echo ------------------------hexo g---------------------------- >> "D:\lanbo\laptype.io\auto_git\commit.txt"
call hexo g >> "D:\lanbo\laptype.io\auto_git\commit.txt"
echo ------------------------hexo s---------------------------- >> "D:\lanbo\laptype.io\auto_git\commit.txt"
call hexo s
echo =================END================>> "D:\lanbo\laptype.io\auto_git\commit.txt"
pause

记得用call

一键上传

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
@echo off

set d=%date:~0,10%
set t=%time:~0,8%

echo ==============cutting line============== >> "D:\lanbo\laptype.io\auto_git\commit.txt"
echo %d% %t% auto commit start... >> "D:\lanbo\laptype.io\auto_git\commit.txt"
echo ------------------------hexo clean------------------------ >> "D:\lanbo\laptype.io\auto_git\commit.txt"
call hexo clean >> "D:\lanbo\laptype.io\auto_git\commit.txt"
echo ------------------------hexo g---------------------------- >> "D:\lanbo\laptype.io\auto_git\commit.txt"
call hexo g >> "D:\lanbo\laptype.io\auto_git\commit.txt"
echo ------------------------hexo d---------------------------- >> "D:\lanbo\laptype.io\auto_git\commit.txt"
call hexo d >> "D:\lanbo\laptype.io\auto_git\commit.txt"
echo ----------------------------git pull---------------------------------- >> "D:\lanbo\laptype.io\auto_git\commit.txt"
call git pull
if errorlevel 1 goto Fail
echo ------------------------hexo clean---------------------------------- >> "D:\lanbo\laptype.io\auto_git\commit.txt"
call hexo clean >> "D:\lanbo\laptype.io\auto_git\commit.txt"
echo ---------------------------git add . --------------------------------- >> "D:\lanbo\laptype.io\auto_git\commit.txt"
call git add .
echo ---------------------------git commit ------------------------------ >> "D:\lanbo\laptype.io\auto_git\commit.txt"
call git commit -m %date:~0,4%-%date:~5,2%-%date:~8,2%
echo ---------------------------git push --------------------------------- >> "D:\lanbo\laptype.io\auto_git\commit.txt"
call git push
echo =================END======================>> "D:\lanbo\laptype.io\auto_git\commit.txt"
if errorlevel 0 goto Success
pause

:Fail
echo fall
pause

:Success
echo =================Success upload======================
pause

右键快捷打开

image-20221028192019053

这个主要是 redegit 里面配置的

image-20221028192209813