Is shutdown.exe necessary when shutting Windows down, or is it just part of what is used to shut Windows down? Are other files and/or processes used instead? Today’s SuperUser Q&A post has the answer to a curious reader’s question.
关闭Windows时是否需要shutdown.exe,或者它只是关闭Windows的一部分吗? 是否改用其他文件和/或进程? 今天的“超级用户问答”帖子回答了一个好奇的读者的问题。
Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.
今天的“问答”环节由SuperUser提供,它是Stack Exchange的一个分支,该社区是由社区驱动的Q&A网站分组。
问题 (The Question)
SuperUser reader Mukul Kumar wants to know if shutdown.exe is necessary for shutting Windows down:
超级用户阅读器Mukul Kumar想知道关闭Windows是否需要shutdown.exe:
Is the file C:\Windows\System32\shutdown.exe necessary to shut down or restart Windows?
关闭或重新启动Windows是否需要文件C:\ Windows \ System32 \ shutdown.exe ?
Is shutdown.exe necessary for shutting down or restarting Windows?
关闭或重新启动Windows是否需要shutdown.exe?
答案 (The Answer)
SuperUser contributor JdeBP has the answer for us:
超级用户贡献者JdeBP为我们提供了答案:
Your question of course originates from your answer at StackExchange, in particular from kinokijuf’s comment upon the initial revision of your answer.
你从你的回答在课程起源的问题StackExchange ,特别是在你的答案的初始版本kinokijuf的评论。
As kinokijuf said, Windows is not Unix. On Unices and Linux, shutdown is indeed involved in the full shut down process. It is the program that sends regular warning messages to logged-in users and that writes the /run/nologin file to prevent further logging-on a short while before the scheduled shut down time.
正如kinokijuf所说,Windows不是Unix。 在Unices和Linux上,关机确实涉及整个关机过程。 该程序会向登录的用户发送常规警告消息,并写入/ run / nologin文件,以防止在计划的关闭时间之前不久进行进一步的登录。
On Windows NT, this is not the case.
在Windows NT上不是这种情况。
The “shut down” action on the “power button” on the Windows Explorer Start menu, the “shut down” menu option in Task Manager, REBOOT /S in TCC or Take Command, and other application programs that allow you to shut the system down all initiate shut down by directly calling one of two Win32 API calls: InitiateSystemShutdownEx() or ExitWindowsEx(). They do not do things indirectly by running the shut down program. That actually needs more code to do than just calling the Win32 API call. The shut down program, when one is doing a local shut down, calls those same Win32 API calls too.
Windows资源管理器“开始”菜单上“电源按钮”上的“关闭”操作,任务管理器中的“关闭”菜单选项,TCC或Take Command中的REBOOT / S以及其他允许您关闭系统的应用程序通过直接调用以下两个Win32 API调用之一来关闭所有启动器:InitiateSystemShutdownEx()或ExitWindowsEx()。 他们不会通过运行关闭程序间接执行操作。 实际上,这不仅需要调用Win32 API调用,还需要执行更多代码。 关闭程序在进行本地关闭时也会调用相同的Win32 API调用。
It is actually winlogon, csrss, and smss that are the programs that shut down Windows NT. In particular, it is winlogon that does the main work of processing deferred shut down requests.
实际上,winlogon,csrss和smss是关闭Windows NT的程序。 特别是,winlogon负责处理延迟的关闭请求。
Further Reading
进一步阅读
Jonathan de Boyne Pollard (2006). The Windows NT 6 shutdown process. Frequently Given Answers.
乔纳森·德·博伊纳·波拉德(2006)。 Windows NT 6关闭过程 。 经常给出答案。
Shutdown. FreeBSD 9.2 manual pages. 2013-03-19.
关机 。 FreeBSD 9.2手册页 。 2013-03-19。
Shutdown. Systemd manual pages. 2013. Freedesktop.org.
关机 。 系统手册页 。 2013。Freedesktop.org。
Shutdown. Upstart manual pages. 2009. Canonical Ltd.
关机 。 新贵手册页 。 2009. Canonical Ltd.
InitiateSystemShutdownEx. MSDN. Microsoft corporation.
InitiateSystemShutdownEx 。 MSDN。 微软公司。
ExitWindowsEx. MSDN. Microsoft corporation.
退出WindowsEx 。 MSDN。 微软公司。
REBOOT. Take Command / TCC Help. JP Software.
重新启动 。 采取命令/ TCC帮助。 JP软件。
Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.
有什么补充说明吗? 在评论中听起来不错。 是否想从其他精通Stack Exchange的用户那里获得更多答案? 在此处查看完整的讨论线程 。
翻译自: https://www.howtogeek.com/185099/is-shutdown.exe-necessary-to-shut-windows-down/