是否可以使用 Windows 中的命令调用运行窗口?

是否可以使用 Windows 中的命令调用运行窗口?

我想知道是否可以通过 CMD、PowerShell 或使用 VBScript 等来调用运行窗口并使用命令/应用程序/目录来运行?

我知道它explorer.exe Shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}存在并且运行不是它自己的独立应用程序(遗憾)但我可以对它发出命令吗?

也许有一种解决方案是打开它,然后使用程序/脚本快速输入它,但是有没有类似cmd /c运行的东西?

答案1

如果您想要运行窗口的命令行版本,简单的解决方案就是该start实用程序:

start https://www.google.com
start %APPDATA%
cmd /c start appname://open/foo

或者为了真正模拟 Run,您可以使用 Run 使用的精确(C++)函数:ShellExecute()


另一方面,如果您想“打开它然后快速输入”,那么您可以尝试一个基本的 sendkeys 脚本:

# powershell
using namespace microsoft.VisualBasic
using namespace System.Windows.Forms

# open Run window
cmd /c 'explorer.exe Shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}'
start-sleep -Milliseconds 500

# type out a command 
[Interaction]::AppActivate(“Run”)
[SendKeys]::SendWait('{%}APPDATA{%}')

相关内容