windows 如何使用命令行卸载Apache
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18448385/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to uninstall Apache with command line
提问by tcardoso
So I'm trying to find a command to uninstall apache from windows that I have installed earlier with an NSIS script.
所以我试图找到一个命令来从我之前使用 NSIS 脚本安装的 Windows 中卸载 apache。
Basically apache is part of a package of aplications we use for our program, and when uninstalling our program we uninstall them all. Already working for postgres, java and ruby, but I'm not finding any command for apache.
基本上 apache 是我们用于程序的应用程序包的一部分,当卸载我们的程序时,我们将它们全部卸载。已经在为 postgres、java 和 ruby 工作,但我没有找到任何适用于 apache 的命令。
I tried the wmic command, but it required user to confirm the action. There isn't any httpd uninstall command?
我尝试了 wmic 命令,但它需要用户确认操作。没有任何httpd卸载命令?
httpd -k uninstall
simply removes the service.
只需删除该服务。
Thanks
谢谢
采纳答案by Flavio Salas
sc delete Apache2.4
Remove service in windows
在 Windows 中删除服务
回答by ironarm
On Windows 8.1 I had to run cmd.exe as administrator (even though I was logged in as admin). Otherwise I got an error when trying to execute: httpd.exe -k uninstall
在 Windows 8.1 上,我必须以管理员身份运行 cmd.exe(即使我以管理员身份登录)。否则我在尝试执行时出错:httpd.exe -k uninstall
Error: C:\Program Files\Apache\bin>(OS 5)Access is denied. : AH00373: Apache2.4: OpenS ervice failed
错误:C:\Program Files\Apache\bin>(OS 5) 访问被拒绝。:AH00373:Apache2.4:OpenS 服务失败
回答by s.isti91
I've had this sort of problem.....
我遇到过这样的问题......
The solve: cmd
/ powershell
run as ADMINISTRATOR!I always forget.
解决方法:cmd
/powershell
以管理员身份运行!我总是忘记。
Notice: In powershell
, you need to put .\
for example:
注意:在 中powershell
,您需要.\
输入例如:
.\httpd -k shutdown .\httpd -k stop .\httpd -k uninstall
Result: Removing the apache2.4
service The Apache2.4
service has been removed successfully.
结果:移除apache2.4
服务Apache2.4
服务已成功移除。
回答by Nazar554
If Apache was installed using NSIS installer it should have left an uninstaller. You should search inside Apache installation directory for executable named unistaller.exe
or something like that. NSIS uninstallers support /S
flag by default for silent uninstall. So you can run something like "C:\Program Files\<Apache installation dir here>\uninstaller.exe" /S
如果 Apache 是使用 NSIS 安装程序安装的,它应该会留下一个卸载程序。您应该在 Apache 安装目录中搜索名为的可执行文件unistaller.exe
或类似的内容。NSIS 卸载程序/S
默认支持静默卸载标志。所以你可以运行类似的东西"C:\Program Files\<Apache installation dir here>\uninstaller.exe" /S
From NSIS documentation:
从 NSIS文档:
3.2.1 Common Options
/NCRC disables the CRC check, unless CRCCheck force was used in the script. /S runs the installer or uninstaller silently. See section 4.12 for more information. /D sets the default installation directory ($INSTDIR), overriding InstallDir and InstallDirRegKey. It must be the last parameter used in the command line and must not contain any quotes, even if the path contains spaces. Only absolute paths are supported.
3.2.1 常用选项
/NCRC 禁用 CRC 检查,除非在脚本中使用了 CRCCheck force。/S 静默运行安装程序或卸载程序。有关更多信息,请参阅第 4.12 节。/D 设置默认安装目录 ($INSTDIR),覆盖 InstallDir 和 InstallDirRegKey。它必须是命令行中使用的最后一个参数,并且不得包含任何引号,即使路径包含空格也是如此。仅支持绝对路径。
回答by Devendra Singraul
Try this :
尝试这个 :
sc delete Apache2.4
sc delete Apache2.4
or try this :
或试试这个:
C:\Apache24\bin>httpd -k uninstall
C:\Apache24\bin>httpd -k uninstall
hope this will be helpful
希望这会有所帮助