Monday, 15 July 2013

vbscript - The batch changes the vbs code making it unreadable for the vbs to use -



vbscript - The batch changes the vbs code making it unreadable for the vbs to use -

the batch changes vbs code making unreadable vbs use. how prepare this?

batch code:

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 * win32_process name = 'file.exe'") >> prio.vbs echo each objprocess in colprocesses >> prio.vbs echo objprocess.setpriority(high) >> prio.vbs echo next >> prio.vbs

vbs orginal:

const high = 128 strcomputer = "." set objwmiservice = getobject("winmgmts:" _ & "{impersonationlevel=impersonate}!\\" & strcomputer & "\root\cimv2") set colprocesses = objwmiservice.execquery _ ("select * win32_process name = 'file.exe'") each objprocess in colprocesses objprocess.setpriority(high) next

vbs after :

const high = 128 strcomputer = "." set objwmiservice = getobject("winmgmts:" _ set colprocesses = objwmiservice.execquery _ ("select * win32_process name = 'file.exe'") each objprocess in colprocesses objprocess.setpriority(high) next

help please

& characters have special meaning in cmd (command-chaining), have escape them literal ampersands:

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

batch-file vbscript

No comments:

Post a Comment