不使用管理,是否可以使用NET命令启动和停止MariaDB服务?

时间:2019-08-12 21:11:14

标签: batch-file cmd mariadb restart shutdown

我已经在Window 7中安装了MariaDB 10.4系列。但是在安装文件夹中没有用于启动/停止和重新启动的选项。因此,我不得不停止使用services.msc工具。因此,我创建了批处理脚本,但是当我运行脚本时,由于我直接从桌面运行脚本,因此出现“拒绝访问”错误消息。我不想以管理员身份运行cmd。我想通过单击直接运行脚本。

enter image description here

以下是批处理脚本:

@eacho off
net stop mariadb
if ERRORLEVEL 1 goto error
exit
:error
echo There was a problem to stop the service
pause

请帮助我,如何在不使用管理命令的情况下使用批处理脚本启动和停止MariaDB服务?

1 个答案:

答案 0 :(得分:0)

通过命令行停止和启动Windows服务:

net stop YOURSERVICENAME
net start YOURSERVICENAME