gpt4 book ai didi

windows - 如何使用批处理文件杀死特定的 VBScript?

转载 作者:可可西里 更新时间:2023-11-01 10:31:57 24 4
gpt4 key购买 nike

如何使用批处理文件杀死特定的 VBScript?

@echo off
set vbs="%temp%\dummy.vbs"

for /f "usebackq tokens=2" %%s in (`WMIC path Win32_Process where 'name="wscript.exe"' get commandline,processid | findstr /i /c:"%vbs%"`) do (
taskkill /f /fi "pid eq %%s"
)

我也尝试了下面的代码,但似乎commandline like 不起作用。

WMIC path Win32_Process where "name='wscript.exe' and commandline like %vbs%" get processid

提前致谢!

最佳答案

在评论中合并项目并使用 ^ 转义特殊字符。

@echo off

set "vbs=%temp%\dummy.vbs"

for /f "usebackq tokens=3" %%s in (
`WMIC process where "name='wscript.exe'" get commandline^,processid ^| findstr /i /c:"%%vbs%%"`
) do (
taskkill /f /fi "pid eq %%s"
)

关于windows - 如何使用批处理文件杀死特定的 VBScript?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52423052/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com