简体   繁体   English

使用 C++ 重新启动 explorer.exe

[英]Restarting explorer.exe using C++

I already took a look at this post: How can I start explorer.exe via C++?我已经看过这篇文章: 如何通过 C++ 启动 explorer.exe? which is an old post.这是一个旧帖子。 I was playing around with batch file command and I wanted to replicate this function using C++我在玩批处理文件命令,我想用 C++ 复制这个函数

taskkill /f /im explorer.exe

start explorer.exe

I'm using the我正在使用

system(" ")系统(” ”)

command in C++ to make it happen. C++ 中的命令来实现它。 Here is the code: Note, killing the explorer.exe is working but I can't start it again.这是代码:注意,杀死 explorer.exe 正在工作,但我无法再次启动它。

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

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

Instead of opening the explorer.exe to bring back the windows UI, it open the quick access in windows.它不是打开 explorer.exe 来恢复 Windows UI,而是在 Windows 中打开快速访问。 Any idea?任何的想法?

using cmd would be %SystemRoot%\\Explorer.exe and to use in c ++ it would be if system("C:/Windows/Explorer.exe")使用 cmd 将是%SystemRoot%\\Explorer.exe并在 C++ 中使用它是 if system("C:/Windows/Explorer.exe")

Your code opens the following file C:/windows/sistem32/explorer what is the user interface, and you have to open the one on this path C:/windows/Explorer.exe I hope it works for you, luck..您的代码打开以下文件C:/windows/sistem32/explorer什么是用户界面,您必须在此路径上打开一个C:/windows/Explorer.exe我希望它对您C:/windows/Explorer.exe ,运气..

Example例子

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM