gpt4 book ai didi

batch-file - 批处理更改了 vbs 代码,使 vbs 无法使用

转载 作者:行者123 更新时间:2023-12-04 05:10:54 28 4
gpt4 key购买 nike

该批处理更改了 vbs 代码,使其无法供 vbs 使用。我该如何解决这个问题?

批号:

echo Const HIGH = 128 >> prio.vbs
echo strComputer = "." >> prio.vbs
echo Set objWMIService = GetObject("winmgmts:" _ >> prio.vbs
echo & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") >> prio.vbs
echo Set colProcesses = objWMIService.ExecQuery _ >> prio.vbs
echo ("Select * from Win32_Process Where Name = 'file.exe'") >> prio.vbs
echo For Each objProcess in colProcesses >> prio.vbs
echo objProcess.SetPriority(HIGH) >> prio.vbs
echo Next >> prio.vbs

VBS原文:
Const HIGH = 128
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'file.exe'")
For Each objProcess in colProcesses
objProcess.SetPriority(HIGH)
Next

VBS 之后:
Const HIGH = 128 
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
Set colProcesses = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'file.exe'")
For Each objProcess in colProcesses
objProcess.SetPriority(HIGH)
Next

请帮忙

最佳答案

&字符在 CMD 中有特殊含义(命令链),所以你必须转义它们才能获得文字&符号:

echo    ^& "{impersonationLevel=impersonate}!\\" ^& strComputer ^& "\root\cimv2") >> prio.vbs

右括号 ')' 和 '<', '>' 也是如此

关于batch-file - 批处理更改了 vbs 代码,使 vbs 无法使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14926767/

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