我有一个恢复资源管理器的批处理文件,然后它必须调用ShowDesktop.scf文件来最小化我桌面上的所有窗口。
如何从批处理中调用这样的文件?只是ShowDesktop.scf做不到这一点。
在ShowDesktop.scf中:
[Shell]
Command=2
IconFile=explorer.exe,3
[Taskbar]
Command=ToggleDesktop在clearEnv.bat中:
taskkill /f /im explorer.exe
explorer.exe
ShowDesk.scf发布于 2018-10-29 16:00:54
简单的答案是使用start。然而,我不知道为什么,但是如果通过CMD运行,ShowDesktop.scf就不能工作。下面是代码:
start "" ShowDesktop.scf不管怎样,我确实通过VBS找到了一个变通方法。将其放入一个空白文本文件中,并将其保存为"anything.vbs“
set objShell = CreateObject("shell.application")
objShell.ToggleDesktop
set objShell = nothing现在,在您的.bat文件中使用以下内容:
taskkill /f /im explorer.exe
explorer.exe
rem Always use the quotes with start, doesn't matter to leave it blank.
start "" anything.vbs这两个文件应该在相同的路径中。否则,您将不得不将补丁指向它。
发布于 2021-05-30 02:45:15
如果你只是想要一个桌面工具,最好使用
C:\Windows\System32\mshta.exe vbscript:Execute("CreateObject(""WScript.Shell"").Run ""cmd /c start /max %SystemRoot%\explorer.exe ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"",0,false:close")这是一个类比。
https://stackoverflow.com/questions/53011931
复制相似问题