不以物喜,不以己悲

explorer.exe命令行

explorer.exe命令行

说明:

当进程中没有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脚本重启资源管理器是无效的,使用上述重启资源管理器亲测有效。

posted @ 2020-06-16 14:30  这种人  阅读(1598)  评论(0编辑  收藏  举报