分解explorer进程,重启桌面而不关闭资源管理器
wmic process where caption="notepad.exe" get caption,commandline /value【精确查找】获取两个explorer进程的命令行,判断哪个是桌面,哪个是资源管理器,然后实现只重启资源管理器。 为什么是notepad.exe 网上搜的范例。 窄口牛 发表于 2018-11-4 08:08网上搜的范例。
然后呢?怎么办才能不关闭资源管理器重启桌面?
下面这句是重启了,但是资源管理器也关闭了。
wmic process where caption="explorer.exe" call terminate 两个进程为
Caption=explorer.exe
CommandLine=C:\Windows\Explorer.EXE
Caption=explorer.exe
CommandLine=C:\Windows\explorer.exe /factory,{ceff45ee-c862-41de-aee2-a022c81eda92} -Embedding
挑选结束上面的,下面的是资源管理的
wmic process where "caption='explorer.exe' and get commandline /value<>'C:\Windows\explorer.exe /factory,{ceff45ee-c862-41de-aee2-a022c81eda92} -Embedding'" call Terminate
这么写不对,正在琢磨该怎么写 窄口牛 发表于 2018-11-4 08:53
两个进程为
Caption=explorer.exe
CommandLine=C:\Windows\Explorer.EXE
现在的结果是这样的,打开了一个资源管理器窗口。。。
Caption=explorer.exe
CommandLine=explorer.exe 本帖最后由 窄口牛 于 2018-11-4 10:51 编辑
你得先修改注册表,变成分离explorer
Windows Registry Editor Version 5.00
"SeparateProcess"=dword:00000001 wmic process where "caption='explorer.exe' andnot commandline like '%factory%'" call terminate 本帖最后由 窄口牛 于 2018-11-4 12:13 编辑
谢谢提示
成品来了
@echo off
reg add "HKCR\Directory\Background\shell\RestartExplorer" /ve /d "重启资源管理器" /f
reg add "HKCR\Directory\Background\shell\RestartExplorer\Command" /ve /d "cmd /c \\"wmic process where \\"caption='explorer.exe' andnot commandline like '%%%%factory%%%%'\\" call terminate\\"" /f
窄口牛 发表于 2018-11-4 10:21
你得先修改注册表,变成分离explorer
Windows Registry Editor Version 5.00
直接改文件夹选项“在单独的进程中打开文件夹窗口”一样。 嗯,应该是的。 窄口牛 发表于 2018-11-4 11:12
谢谢提示
成品来了
注册表键值中含有引号,批处理中必须使用\转义 本帖最后由 窄口牛 于 2018-11-4 14:02 编辑
论坛的锅
@echo off
reg add "HKCR\Directory\Background\shell\RestartExplorer" /ve /d "重启资源管理器" /f
reg add "HKCR\Directory\Background\shell\RestartExplorer\Command" /ve /d "cmd /c \"wmic process where \"caption='explorer.exe' andnot commandline like '%%%%factory%%%%'\" call terminate\"" /f
在代码里面需要两个\ 窄口牛 发表于 2018-11-4 12:12
论坛的锅
@echo off
reg add "HKCR\Directory\Background\shell\RestartExplorer" /ve /d "重启资源管 ...
{:1_186:}{:1_201:}
论坛的代码还有其它问题记得,不太好用
我改成按shift键出来了,一般隐藏
谢谢楼主分享技术资料!!很感兴趣!!
页:
[1]