SC命令(windows服务开启/禁用)
原文链接地址:https://blog.csdn.net/cd520yy/article/details/30976131
sc.exe命令功能列表:
1.更改服务的启动状态(这是比较有用的一个功能)
2.删除服务(除非对自己电脑的软、硬件所需的服务比较清楚,否则不建议删除任何系统服务,特别是基础服务)
3.停止或启动服务(功能上类似于net stop/start,但速度更快且能停止的服务更多)
具体的命令格式如下:
修改服务启动类型的命令行格式为(特别注意start=后面有一个空格)
sc config 服务名称 start= demand(设置服务为手动启动)
sc config 服务名称 start= disabled(设置服务为禁用)
停止/启动服务的命令行格式为
sc stop/start 服务名称
注意:平时常接触的都是服务的显示名称,而以上所指是服务名称,都可以在控制面板->管理工具->服务里面,双击对应的服务来查询。
先举例说明一下具体的设置方法:
如设置远程注册表服务为手动其格式为
sc config RemoteRegistry start= demand
设为禁用的格式为:
sc config RemoteRegistry start= disabled
停止服务则格式为:
sc stop RemoteRegistry
首先把自己所需设置的服务名称查到之后,按照上面的格式做成批处理文件,重装系统之后只要运行批处理文件即可。
以下是我的设置,以XpSp2为蓝本,可比对所用的系统进行增删和修改。注:未加入XpSp2的自动更新、安全中心、防火墙。
sc config Alerter start= demand
sc config TrkWks start= demand
sc config helpsvc start= demand
sc config policyAgent start= demand
sc config dmserver start= demand
sc config WmdmpmSn start= demand
sc config Spooler start= demand
sc config RemoteRegistry start= demand
sc config NtmsSvc start= demand
sc config seclogon start= demand
sc config Schedule start= demand
sc config WebClient start= demand
sc config W32Time start= demand
sc config WZCSVC start= demand
sc config ERSvc start= demand
sc config Themes start= demand
sc config FastUserSwitchingCompatibility start= disabled
sc config Messenger start= disabled
sc config protectedStorage start= disabled
sc config SSDpSRV start= disabled
sc config TermService start= disabled
sc config ShellHWDetection start= disabled
如果需要立即关闭服务也可把以下代码跟在上面的代码之后
sc stop W32Time
sc stop ShellHWDetection
sc stop TrkWks
sc stop helpsvc
sc stop dmserver
sc stop policyAgent
sc stop Spooler
sc stop RemoteRegistry ;远程修改注册表
sc stop seclogon
sc stop Schedule
sc stop WZCSVC
sc stop ERSvc
sc stop Themes
sc stop FastUserSwitchingCompatibility
sc stop protectedStorage
sc stop SSDpSRV
sc stop WebClient
最后把修改好之后的代码存为services.cmd,在以后进行服务设置时,直接运行事先保存好的批处理文件就可以做到事半功倍了。
看到这里,使用Win2000的朋友也不必失望,sc.exe这个命令行工具对Win2000同样适用,可从装有WinXp或者Win2003的机器里面拷贝sc.exe文件,与保存好的批处理文件放在一起,然后执行批处理文件即可。
对注册表比较熟悉的朋友可能会想到用注册表来设置服务的启动类型,这也是一种可行的方法,本身却有着内在不足。原因是服务启动类型在注册表中对应的键值较长且分散,进行整理不方便直观且易错漏,所以这种方法比较适用于无人值守的安装时使用。
SC命令(windows服务开启/禁用)的更多相关文章
- (转)SC命令---安装、开启、配置、关闭windows服务 bat批处理
本文转载自:http://blog.csdn.net/moruna/article/details/9190733 废话不多说,看命令行更直接! 一.直接使用cmd来进行服务的一些操作 1.安装服务 ...
- windows服务开启(收藏url)
windows服务开启(收藏url) http://blog.csdn.net/wanda39kela/article/details/46310093
- SC命令---安装、开启、配置、关闭 cmd命令行和bat批处理操作windows服务
一.cmd命令行---进行Windows服务操作 1.安装服务 sc create 服务名 binPath= "C:\Users\Administrator\Desktop\win32s ...
- cmd sc命令进行服务操作
sc 命令可以注册.删除和查询系统服务 sc可供选择的参数有很多,这里不详细描述.只介绍简单的最基本的sc使用方式. 1. sc create 创建windows服务 eg: sc \\myserve ...
- SC命令---安装、开启、配置、关闭windows服务 bat批处理(转载)
转载:http://www.jb51.net/article/49627.htm 转载:http://blog.csdn.net/c1520006273/article/details/5053905 ...
- SC命令---安装、开启、配置、关闭windows服务 bat批处理
一.直接使用cmd来进行服务的一些操作 1.安装服务 sc create test3 binPath= "C:\Users\Administrator\Desktop\win32srvDem ...
- [PowerShell]Windows服务开启、重启、关闭
# 获取服务信息 PS C:\Users\Administrator> Get-Service win* Status Name DisplayName ------ ---- -------- ...
- cmd命令行和bat批处理操作windows服务(转载)
一.cmd命令行---进行Windows服务操作 1.安装服务 sc create 服务名 binPath= "C:\Users\Administrator\Desktop\win32srv ...
- Windows:使用Dos命令管理服务(Services)
Windows 服务器系列: Windows:查看IP地址,IP地址对应的机器名,占用的端口,以及占用该端口的应用程 Windows:使用Dos命令管理服务(Services) Windows:任务调 ...
随机推荐
- 【转】CentOS Linux解决Device eth0 does not seem to be present(linux)
原文来自:http://www.linuxidc.com/Linux/2012-12/76248.htm 在VMware里克隆出来的CentOS Linux.. ifconfig...没有看到eth0 ...
- nuget必备插件(待续)
DevLib.ExtensionMethods Extend Z.ExtensionMethods
- centos7 python2.7.5 升级python3.6.4
(转)Linux Centos7 升级python2至python3 - 依然范儿特西的文章 - 知乎 https://zhuanlan.zhihu.com/p/33660059 1 查看python ...
- Mac系统STF自动化环境搭建及部署踩坑记录
因为公司需要寻找一个免root的自动化测试方案,所以以前做的老方案需要被替代.一阵搜寻找到了这个框架,但是部署起来很是折腾,搞了一下午终于搞定,顺便记录一下过程,有需要的自取. 转载请注明出处:htt ...
- 2.1 Oracle之DML的SQL语句之单表查询以及函数
1.SQL简介 对于不同的数据库来说,SQL语句是相通的,关系型数据库都以SQL语句为操作的标准,只是相应的数据库对应的函数不相同. SQL(Structured Query Language,结构化 ...
- zabbix搭建并结合mikoomi插件监控hadoop集群
一.环境说明 系统: CentOS release 6.4 mysql 5.1.67 Apache/2.2.25 二.安装php 由于zabbix提供的frontends是php编写的,因此需要搭建l ...
- zabbix_agentd-install.sh (脚本部署zabbix_agentd服务)
原文发表于cu:2016-05-20 基于http://www.cnblogs.com/netonline/p/7406598.html(http://blog.chinaunix.net/uid-2 ...
- django项目中关于跨域CORS
1.使用django-cors-headers扩展,但首先进行安装 2.在配置中添加应用 3.在中间层中设置:“corsheaders.middleware.CorsMiddleware” 4.添加C ...
- drupal CVE-2018-7600 复现
1.系统环境 Drupal 8.5 linux 主机 ruby 代码 2.原理说明 影响版本 Drupal 6.x,7.x,8.x 参考:CVE-2018-7600漏洞分析 3.利用 在Python2 ...
- “来用”Beta版使用说明
补发Beta版使用说明.Beta版与alpha版相比去掉了计算器,界面上没有太大变化. 1引言 1 .1编写目的 针对我们发布的Beta版本做出安装和使用说明,使参与内测的人员及用户了解软件的使用方法 ...