说明:

当进程中没有explorer.exe时,运行explorer.exe即启动外壳程序;当外壳程序已经启动时,运行explorer.exe将会打开“我的文档"。

参数

/n

为默认选择内容打开一个新的单窗格窗口。默认选择内容通常是安装windows的驱动器的根目录

/e

使用默认视图启动windows资源管理器

/root,

打开指定对象的一个窗口视图

/select,

打开一个窗口视图,指定的文件夹、文件或程序被选中。

也可以使用CLSID来指定系统文件夹,如下命令:

explorer.exe /select,::{450D8FBA-AD25-11D0-98A8-0800361B1103}

也可以使用环境变量来指定文件夹路径,如下命令:

explorer.exe /select,%SystemRoot%

将启动windows资源管理器,并定位到"windows"。

重启explorer进程刷新页面

@echo off
taskkill /f /im explorer.exe
start explorer.exe
exit

补充:在nsis脚本中执行重启资源管理器

FindWindow $0 "Progman" "Program Manager"
System::Call User32::GetWindowThreadProcessId(ir0,*i.r0)
System::Call Kernel32::OpenProcess(i0x0001,i,ir0)i.r0
System::Call Kernel32::TerminateProcess(ir0,i0)
System::Call Kernel32::CloseHandle(ir0)

在nsis中执行使用bat脚本重启资源管理器是无效的,使用上述重启资源管理器亲测有效。

相关文章:

  • 2021-09-19
  • 2022-02-23
  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
  • 2021-11-01
猜你喜欢
  • 2022-01-27
  • 2022-02-07
  • 2021-09-07
  • 2021-08-12
  • 2022-12-23
  • 2021-08-18
  • 2022-02-12
相关资源
相似解决方案