windows - 如何通过bat文件重新启动Windows时给出原因

标签 windows batch-file restart shutdown logoff

我正在使用bat文件重新启动我的Windows服务器。重新启动服务器时,它询问重新启动原因,我如何通过同一个批处理文件给出原因。

我在bat文件中使用的命令是shutdown.exe -r -t 00

最佳答案

这是我使用的一个示例:

shutdown -r /t 5 /d u:0:0 /c "Blah Blah Process is running slow" /m \\MyServer

/c 允许您指定注释

/d允许您给出原因

    /d [p|u:]xx:yy  Provide the reason for the restart or shutdown.
               p indicates that the restart or shutdown is planned.
               u indicates that the reason is user defined.
               If neither p nor u is specified the restart or shutdown is
               unplanned.
               xx is the major reason number (positive integer less than 256).
               yy is the minor reason number (positive integer less than 65536).

Reasons on this computer:
(E = Expected U = Unexpected P = planned, C = customer defined)
Type    Major   Minor   Title

 U      0       0       Other (Unplanned)
E       0       0       Other (Unplanned)
E P     0       0       Other (Planned)
 U      0       5       Other Failure: System Unresponsive
E       1       1       Hardware: Maintenance (Unplanned)
E P     1       1       Hardware: Maintenance (Planned)
E       1       2       Hardware: Installation (Unplanned)
E P     1       2       Hardware: Installation (Planned)
E       2       2       Operating System: Recovery (Planned)
E P     2       2       Operating System: Recovery (Planned)
  P     2       3       Operating System: Upgrade (Planned)
E       2       4       Operating System: Reconfiguration (Unplanned)
E P     2       4       Operating System: Reconfiguration (Planned)
  P     2       16      Operating System: Service pack (Planned)
        2       17      Operating System: Hot fix (Unplanned)
  P     2       17      Operating System: Hot fix (Planned)
        2       18      Operating System: Security fix (Unplanned)
  P     2       18      Operating System: Security fix (Planned)
E       4       1       Application: Maintenance (Unplanned)
E P     4       1       Application: Maintenance (Planned)
E P     4       2       Application: Installation (Planned)
E       4       5       Application: Unresponsive
E       4       6       Application: Unstable
 U      5       15      System Failure: Stop error
 U      5       19      Security issue (Unplanned)
E       5       19      Security issue (Unplanned)
E P     5       19      Security issue (Planned)
E       5       20      Loss of network connectivity (Unplanned)
 U      6       11      Power Failure: Cord Unplugged
 U      6       12      Power Failure: Environment
  P     7       0       Legacy API shutdown 

关于windows - 如何通过bat文件重新启动Windows时给出原因,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17331175/

相关文章:

c# - 为什么Electron杀死带有冒号参数的Windows进程?

c++ - 如何使用 C++ 在 Windows 上检索分页文件大小的 "Minimum allowed"/"Recommended"/"Currently allocated"值?

python - 在Python 3中为Windows用户创建程序,无法使用PIL?

windows - 在接受用户输入后使用批处理文件设置权限

windows - 批处理文件在执行后无限循环闪烁命令提示符

django - 如果 Django 崩溃,在生产模式下会发生什么?

c - 如何在 Windows 上使用 C 将原始数据读写到 USB 驱动器

batch-file - 如何在Windows命令行环境中串行运行多个批处理文件

azure - Azure 应用服务重新启动时会发生什么?

python - 在不影响用户的情况下重新启动 Web 服务器?