我有一个Windows XP SP2虚拟机,可以通过VNC访问.它还运行Deep Freeze,因此强制重启时应该没有问题.我正在寻找一种方法来强制操作系统重新启动,而不是关闭或完全删除使用软件应用程序关闭机器的能力(例如从开始菜单,关机程序或其他自定义程序的常规方式).
汤姆,谢谢你
我有一个 Qt 4.6.2 应用程序,在 Windows XP SP2 x64 系统上运行。
当我按下系统上的物理电源/关机按钮时,当我的应用程序运行时不会发生任何事情,应用程序不会关闭并且系统不会关机。
如果我转到开始菜单并单击关闭,那么我的应用程序将关闭但系统不会关闭。
关闭我的应用程序后,系统会以两种方式正常关闭。
有什么想法可以让我的应用程序正常运行并允许系统正确关闭吗?
谢谢,扎克
我对Windows的批处理文件不太熟悉,所以这看起来像是一个初学者的问题.我怎么能"循环"或重复一个如下命令呢?
shutdown -a
Run Code Online (Sandbox Code Playgroud) 我试图在我的自制操作系统中添加一个关机功能,但我还没有这样的API.我想知道操作系统如何终止电源?
我尝试开始,mongod.exe但我有,我收到以下错误:
C:\MongoDB\Server\30\bin>mongod.exe
2015-12-16T19:12:17.108+0100 I CONTROL 2015-12-16T19:12:17.110+0100 W CONTROL 32-bit servers don't have journaling enabled by default.
Please use --journal if you want durability.
2015-12-16T19:12:17.110+0100 I CONTROL
2015-12-16T19:12:17.120+0100 I CONTROL Hotfix KB2731284 or later update is not installed, will zero-out data files
2015-12-16T19:12:17.132+0100 I STORAGE [initandlisten] **************
2015-12-16T19:12:17.132+0100 I STORAGE [initandlisten] Error: journal files are present in journal directory, yet starting without journaling enabled.
2015-12-16T19:12:17.133+0100 I STORAGE [initandlisten] It is recommended that you start with journaling enabled so that …Run Code Online (Sandbox Code Playgroud) 我正在制作一个程序,为我自动完成一些繁琐的任务,程序完成后我想关闭windows.我知道这可以在例如C#中完成
如何使用golang关闭窗口?
我最近开始学习 xv6 并试图在 xv6 中实现关闭机制,我能够终止所有正常运行的进程并等待其中一些完成然后终止它们。但是我无法从关机过程中关闭 qemu。
有人可以建议如何从 aa xv6 进程关闭 qemu 吗?
我用谷歌搜索,发现有人使用了“outb”和“outw”命令,但它们都不起作用。
我正在使用以下 Ansible playbook 一次性关闭远程 Ubuntu 主机列表:
- hosts: my_hosts
become: yes
remote_user: my_user
tasks:
- name: Confirm shutdown
pause:
prompt: >-
Do you really want to shutdown machine(s) "{{play_hosts}}"? Press
Enter to continue or Ctrl+C, then A, then Enter to abort ...
- name: Cancel existing shutdown calls
command: /sbin/shutdown -c
ignore_errors: yes
- name: Shutdown machine
command: /sbin/shutdown -h now
Run Code Online (Sandbox Code Playgroud)
关于这个的两个问题:
我尝试了net_ping 模块,但我不确定这是否是它的真正目的:
- name: Check that machine is down
become: no
net_ping:
dest: "{{ …Run Code Online (Sandbox Code Playgroud) 这篇文章说:
如果应用程序必须阻止潜在的系统关闭,它可以调用 ShutdownBlockReasonCreate 函数。调用者提供将显示给用户的原因字符串。
在ShutdownBlockReasonCreate文档中,它清楚地表明在尝试关闭时将向用户显示一个带有原因字符串的对话框窗口:
表示系统无法关闭,并设置一个原因字符串,如果系统启动,则显示给用户
用户可以单击“仍然关闭”。此外,如果用户在几秒钟内没有采取任何行动,系统会假设“无论如何都要关闭”。
但是,在我调用ShutdownBlockReasonCreate传递当前应用程序的主窗口句柄后,确保该函数成功并通过调用ShutdownBlockReasonQuery函数来检索原因字符串来双重确保它,它不会阻止用户关闭系统和没有对话框窗口显示。
为什么它对我的系统没有影响?,我该如何解决这个问题?。
我使用管理员(内置)帐户在 Windows 10 x64 上运行,我使用的代码来自此GitHub 存储库:
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Vanara.PInvoke;
using static Vanara.PInvoke.User32;
namespace Vanara.Windows.Forms.Forms
{
/// <summary>Used to define a set of operations within which any shutdown request will be met with a reason why this application is blocking it.</summary>
/// <remarks>This is to be used in either a 'using' statement or …Run Code Online (Sandbox Code Playgroud) 我有一个带有 server.shutdown=graceful 的 spring boot 2.3+ 应用程序,当关闭时抛出:
2020-11-30 11:07:35.485 WARN 3038 --- [SpringContextShutdownHook] o.s.c.support.DefaultLifecycleProcessor : Failed to stop bean 'webServerGracefulShutdown'
java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: org/springframework/boot/web/server/GracefulShutdownResult
at org.springframework.boot.web.servlet.context.WebServerGracefulShutdownLifecycle.stop(WebServerGracefulShutdownLifecycle.java:51)
at org.springframework.context.support.DefaultLifecycleProcessor.doStop(DefaultLifecycleProcessor.java:238)
at org.springframework.context.support.DefaultLifecycleProcessor.access$300(DefaultLifecycleProcessor.java:53)
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.stop(DefaultLifecycleProcessor.java:377)
at org.springframework.context.support.DefaultLifecycleProcessor.stopBeans(DefaultLifecycleProcessor.java:210)
at org.springframework.context.support.DefaultLifecycleProcessor.onClose(DefaultLifecycleProcessor.java:128)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1022)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.doClose(ServletWebServerApplicationContext.java:170)
at org.springframework.context.support.AbstractApplicationContext$1.run(AbstractApplicationContext.java:949)
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/web/server/GracefulShutdownResult
... 9 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.web.server.GracefulShutdownResult
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:151)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 9 common frames omitted
2020-11-30 11:08:05.486 INFO 3038 --- [SpringContextShutdownHook] o.s.c.support.DefaultLifecycleProcessor : Failed to shut down 1 …Run Code Online (Sandbox Code Playgroud)