我正在尝试找到如何使用其标题关闭进程。
我找到了命令:
taskkill /fi "WINDOWTITLE eq the_title_of_the_windows"
Run Code Online (Sandbox Code Playgroud)
而且效果很好。
当我尝试时:
oShell.Run "taskkill /fi "WINDOWTITLE eq the_title_of_the_windows"", , True
Run Code Online (Sandbox Code Playgroud)
我收到错误并且无法编译。
关于如何在这一行中使用符号“有什么想法吗?
为了在另一对双引号内使用双引号,您需要使用""而不是 just ",因为如果您使用一个引号,"它将被视为第一个和第二个引号之间的文本结尾
所以,你的代码应该是这样的:
oShell.Run "taskkill /fi ""WINDOWTITLE eq the_title_of_the_windows""", , True
Run Code Online (Sandbox Code Playgroud)
以下示例将终止带有窗口标题(计算器)的所有进程:
Dim oShell
Set oShell = WScript.CreateObject ("WScript.Shell")
oShell.Run "taskkill /fi ""WINDOWTITLE eq Calculator""", , True
Run Code Online (Sandbox Code Playgroud)
希望有帮助:)