在 Windows 关机时执行批处理脚本 [英] Executing a batch script on Windows shutdown

查看:31
本文介绍了在 Windows 关机时执行批处理脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows 7 Professional 中,有什么方法可以在用户单击关闭"时运行批处理脚本(例如,.BAT 文件)(而不是计划关闭的批处理文件)机器,只有当用户点击关机"时才会运行)?

Is there any way, in Windows 7 Professional, to run a batch script (e.g., a .BAT file) when the user clicks on "shutdown" (not a batch file scheduled to shut down the machine, just one that runs only if the user clicks on "shutdown")?

理想情况下,这样的脚本会显示命令提示符窗口并提供取消关机过程的选项.

Ideally, such a script would show the command prompt window and offer an option to cancel the shutdown procedure.

不需要第三方实用程序的解决方案会更好.

Solutions that do not require a third-party utility would be preferable.

推荐答案

您可以在 Windows 上创建本地计算机策略.请参阅 http://technet.microsoft.com/en-us/magazine/dd630947 上的 TechNet/p>

You can create a local computer policy on Windows. See the TechNet at http://technet.microsoft.com/en-us/magazine/dd630947

  1. 运行 gpedit.msc 以打开组策略编辑器,
  2. 导航到 计算机配置 |Windows 设置 |脚本(启动/关闭).
  1. Run gpedit.msc to open the Group Policy Editor,
  2. Navigate to Computer Configuration | Windows Settings | Scripts (Startup/Shutdown).

这篇关于在 Windows 关机时执行批处理脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆