What exactly does “shutdown -y” do? [closed]

只谈情不闲聊 提交于 2020-01-02 03:31:30

问题


I tried some random parameters after the shutdown command in PowerShell 2.0 when I stumbled upon shutdown -y. All it seems to do is log out the user.
if any other random letter is used (that isn't a valid parameter) nothing happens. For example: shutdown -b

My question is: Does shutdown -y do anything special?

I could not find any documentation about this.


回答1:


The Windows 2000 documentation states the following:

/y: Use this switch to force a "yes" answer to all queries from the computer.

So it looks like by using -y or /y with no other switches you are doing the default behaviour of shutdown.exe, which is to logoff the user while also forcing any confirm prompts to be acknowledged with yes.




回答2:


Shutdown is not exactly a PowerShell command. It's the same shutdown.exe that also works in CMD.

Interestingly, the -y command is not mentioned in the documentation. As Mark Wragg found out, it's used to force a "yes" answer for remote shutdown. So, if no other parameters are specified, the default action (logoff user) is executed.

Another question: Why were you trying random parameters? Follow the docu and you're less likely to encounter any unexpected behavior.



来源:https://stackoverflow.com/questions/46071009/what-exactly-does-shutdown-y-do

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!