首页 > 解决方案 > 使用 C++ 重新启动 explorer.exe

问题描述

我已经看过这篇文章:如何通过 C++ 启动 explorer.exe?这是一个旧帖子。我在玩批处理文件命令,我想用 C++ 复制这个函数

taskkill /f /im explorer.exe

start explorer.exe

我正在使用

系统(” ”)

C++ 中的命令来实现它。这是代码:注意,杀死 explorer.exe 正在工作,但我无法再次启动它。

#include "pch.h"
#include <windows.h>
#include <iostream>

int main ()
{
  system("taskkill /f /im explorer.exe");
  system("explorer.exe");
}

它不是打开 explorer.exe 来恢复 windows UI,而是在 windows 中打开快速访问。任何想法?

标签: c++windows

解决方案


使用 cmd 将是%SystemRoot%\Explorer.exe 并且在 c ++ 中使用它会是如果system("C:/Windows/Explorer.exe")

您的代码打开以下文件C:/windows/sistem32/explorer 什么是用户界面,您必须在此路径上打开一个C:/windows/Explorer.exe 我希望它对您有用,运气..

例子

#include "pch.h"
#include <windows.h>
#include <iostream> 

int main ()
{
   system("taskkill /f /im explorer.exe");
   system("C:/windows/Explorer.exe");
}```  

推荐阅读