脚本启动和关闭 jupyter notebok 并隐藏命令行

注意:该作者博客已迁移至https://buxianshan.xyz

脚本启动 jupyter notebok

在桌面新建文本文件 “jupyter.bat” (以bat结尾就行),输入以下代码,倒数第二行的D:\Jupyter_workspace修改为你想要作为根目录的路径

%隐藏cmd窗口%
@echo off
if "%1"=="h" goto begin
start mshta vbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit
:begin
cd /d D:\Jupyter_workspace
jupyter notebook

双击该文件即可启动jupyter notebok,并且不会弹出命令行
在这里插入图片描述
在任务管理器可以看到 jupyter-notebook.exe 正在运行,可以右键结束进程。
在这里插入图片描述

脚本关闭 jupyter notebok

新建文本文件 “Kill Jupyter.bat” (以bat结尾就行),输入以下代码:

%隐藏cmd窗口%
@echo off
if "%1"=="h" goto begin
start mshta vbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit
:begin
taskkill /f /im jupyter-notebook.exe

双击该文件即可关闭 jupyter notebok
在这里插入图片描述
其实 jupyter notebok 占用内存也不大,不在意的话可以不关闭,让它一直在后台运行,这样你随时都可以打开浏览器使用

  • 13
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 9
    评论
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值