新建文章附带版权配置信息

author:troy
website : https://www.zygd.site

每次写文章都会忘记加联系方式

自从有位老哥从外国找到我中国的文章后

我就明白了

这么多爬虫,万一文章没写明白,别人想问问题都不知道问谁

Windows脚本

保存为 新建文章.bat 放在桌面

需要添加其他的记得注意换行

需要一行一行 echo 特殊字符 < > 需要 ^ 转义

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
@echo off
chcp 65001
setlocal EnableDelayedExpansion
set /p article=Please enter your article name :
set /p tags=Please enter your tags name :
set /p categories=Please enter your categories name :
set times=%date:~3,4%-%date:~8,2%-%date:~11,2% %time:~0,2%:%time:~3,2%:%time:~6,2%
echo %times%
echo --- > %article%.md
echo title: %article% >> %article%.md
echo date: %times% >> %article%.md
echo tags: %tags% >> %article%.md
echo categories: %categories% >> %article%.md
echo. >> %article%.md
echo --- >> %article%.md
echo. >> %article%.md
echo # %article% >> %article%.md
echo ^> author:troy >> %article%.md
echo ^> website : www.zygd.site >> %article%.md
echo. >> %article%.md
echo. >> %article%.md
echo. >> %article%.md
echo ^<a target="_blank" href="https://wpa.qq.com/msgrd?v=3&uin=3071597936&site=qq&menu=yes"^>^<img border="0" src="https://cdn.jsdelivr.net/gh/zygds/api-logo@master/qqtalk.png" alt="点击这里给我发消息" title="点击这里给我发消息" style="width:70px" /^>^</a^> >> %article%.md
%typora% %article%.md
msg %username% /time:10 "文章已创建,请保存后返回终端确认!"
exit
pause

把桌面的md拖动到下面这个脚本上,会自动完成copygit push的操作

地址看着改 rem 此处的1是占位符 这个别取消注释,要么不动,要么删掉

1
2
3
4
5
6
7
8
9
10
11
12
13
rem @echo off
chcp 65001
set push_path=D:\Github\cdn\md\
rem set push_path1=D:\Github\blog\source\_posts\
set addres=%*1
rem 此处的1是占位符
set address=%addres:~23,-1%
COPY %address% %push_path%%address%
D: && cd D:\Github\cdn && git add . && git commit -m "update" && git push
rem C: && COPY %address% %push_path1%%address%
rem D: && cd D:\Github\blog\ && git add . && git commit -m "update" && git push
msg %username% /time:10 "任务已完成,正常退出!"
exit

详解

chcp 65001 : 汉化

set /p : 输入赋值

set times=%date:0,4%-%date:5,2%-%date:8,2% %time:0,2%:%time:3,2%:%time:6,2% : 时间戳

%article% : 调用值

^ : 特殊符号输出

然后git3连

Linux脚本

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
36
37
38
39
40
41
42
read -p "Please enter your article name : " article
read -p "Please enter your tags name : " tags
read -p "Please enter your categories name : " categories
times=`date "+%Y-%m-%d %H:%M:%S"`

cat > $article".md" << EOF
---
title: $article
date: $times
tags: $tags
categories: $categories
---

# $article

> author:troy
> website : www.zygd.site



<a target="_blank" href="https://wpa.qq.com/msgrd?v=3&uin=3071597936&site=qq&menu=yes"><img border="0" src="https://cdn.jsdelivr.net/gh/zygds/api-logo@master/qqtalk.png" alt="点击这里给我发消息" title="点击这里给我发消息" style="width:70px" /></a>
EOF
echo -e "\a"
echo 文章已创建,请保存后返回终端确认!

push_path="D:\Github\cdn\md\\"
push_path1="D:\Github\blog\source\_posts\\"
address=$article".md"

echo.
echo We Will Go!
echo -e "\a"
set /p a=Are you sure?

cp $address $push_path$address
cd "D:\Github\cdn\\" && git add . && git commit -m "update" && git push
cd -
cp $address $push_path1$address
cd "D:\Github\blog\\" && git add . && git commit -m "update" && git push
echo -e "\a"
exit

详解

read -p “Please enter your article name : “ article : 输入赋值

然后git3连

Linux就没这么多屁事,实际上,Windows上安装了Git也能运行Linux程序

也就是说Linux这个版本通用

mac脚本

请参阅Linux脚本,理论通用!

点击这里给我发消息