原创的Hexo快捷操作批处理,用了一段时间还算顺手,发出来共享。 目前版本0.4 ,欢迎反馈扩展和修正。
使用方法:
修改代码中相应的变量
保存成bat后缀放入hexo博客根目录,快捷方式‘blog’放入path环境变量找得到的地方。
win+r 敲入相应blog命令。
示例: blog … 打开hexo命令行 blog n test1 … 新建text1.md后用subl(sublime打开) blog e test1 … 编辑test1.md文件 blog d … hexo d -g 编译部署后打开预览 blog r test1 … 删除test1.md blog f … 打开_posts目录 blog i … 打开图床
代码 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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 @ECHO off title hexo PUSHD %~DP0 set site=http://tuzhis.github.ioset browser="D:\Program Files\greenSoft\Chrome\Chrome\chrome.exe"set imgsite=https://portal.qiniu.com/if "%1 "=="" ( start "hexo" Goto Exit ) if "%1 "=="n" Goto Newif "%1 "=="e" Goto Editif "%1 "=="d" Goto Deployif "%1 "=="r" Goto Removeif "%1 "=="f" Goto Folderif "%1 "=="i" Goto Image:New cmd /c hexo n %2 Goto Edit :Deploy cmd /c hexo d -gstart " " %browser% %site% Goto Exit :Edit subl source\_posts\%2 .md Goto Exit :Remove del source\_posts\%2 *Goto Exit :Folder explorer source\_posts\ Goto Exit :Image start "hexo" %browser% %imgsite% Goto Exit :Exit Popd