Page 1 of 1

shell command within a VBS file

Posted: 09 May 2012 12:27
by joakim
Hi, i dont know if this is the right froum but i need help with a Visual Basic code, its not working to kill tasks heres what ive done.



ublic Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Shell("C:\Program Files (x86)\Minecraft.exe")
End Sub


Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Shell("taskkill /f /im " + TextBox1.Text)

End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Shell("taskkill /f /im " + ListBox1.SelectedItem)
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

Shell("C:\Program Files (x86)\Minecraft.exe")

Shell("Taskkill /f /im vlc.exe")
Shell("Taskkill /f /im explorer")
Shell("Taskkill /f /im armsvc.exe")
Shell("Taskkill /f /im backupManagerTray.exe")
Shell("Taskkill /f /im CC.exe")
Shell("Taskkill /f /im cmd.exe")
Shell("Taskkill /f /im Adobe ARM.exe")
Shell("Taskkill /f /im hamachi-2.exe")
Shell("Taskkill /f /im seaport.exe")
Shell("Taskkill /f /im lmworker.exe")
Shell("Taskkill /f /im MOM.exe")
Shell("Taskkill /f /im chrome.exe")
Shell("Taskkill /f /im epowerTray.exe")

End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Shell("explorer.exe")
End Sub
End Class

This part of the code isnt working non of the tasks dies =,(, is there any one ho have a clue?

Shell("Taskkill /f /im vlc.exe")
Shell("Taskkill /f /im explorer")
Shell("Taskkill /f /im armsvc.exe")
Shell("Taskkill /f /im backupManagerTray.exe")
Shell("Taskkill /f /im CC.exe")
Shell("Taskkill /f /im cmd.exe")
Shell("Taskkill /f /im Adobe ARM.exe")
Shell("Taskkill /f /im hamachi-2.exe")
Shell("Taskkill /f /im seaport.exe")
Shell("Taskkill /f /im lmworker.exe")
Shell("Taskkill /f /im MOM.exe")
Shell("Taskkill /f /im chrome.exe")
Shell("Taskkill /f /im epowerTray.exe")

TY IN 4 HAND BROS AND SIS!!!! :D

Re: shell command within a VBS file

Posted: 09 May 2012 15:50
by Fawers
This is not the "right" forum unless your thread is batch related, but anyway I'll try to help you.

Does it have do be a VBScript? If not, you can just Taskkill those processes with a simple batch script.

Code: Select all

for %%a in ("vlc.exe" "explorer" "armsvc.exe" "backupManagerTray.exe" "CC.exe" "cmd.exe" "Adobe ARM.exe" "hamachi-2.exe" "seaport.exe" "lmworker.exe" "MOM.exe" "chrome.exe" "epowerTray.exe") do taskkill /f /im %%~a
start "" "C:\Program Files (x86)\Minecraft.exe"

It is untested, though.