July 1st, 2003, 04:09 AM
Starting and stopping Apps with a script
I'm puzzled with this problem:
I downloaded and installed a nice spam filter, called "email express!"
It seems to meet my needs, but I need a way to start and stop it when I start
and stop my dial up connection. If I leave the filter running when I'm off line, it
becomes unresponsive the next time I check the mail.
I copied and pasted and modified some VBScript code from the net:
So far, this script will start the connection, and the filter, but I've been unable to
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run("%windir%\RUNDLL32.EXE RNAUI.DLL,RnaDial Internet")
ReturnCode = WshShell.Run("%windir%\RUNDLL32.EXE RNAUI.DLL,RnaDial Internet", 1, True)
discover a way to shut down the processes from a VBScript.
Am I barking up the wrong tree? My system is win98, and I also have perl on
the system, but don't know any perl either.
I came in to the world with nothing. I still have most of it.
July 1st, 2003, 04:24 AM
The unix kill command has been ported to Win32..... you could use some *nix commands together.... ps x | grep <app name>, kill <yada>..... something along those lines.. I'll include a zip with the files... you can play around with them...
I have also added the cut command, so you can cut the process id from the line you grep from the ps command... if you need assistance setting up the exact commands just let me know... I'm just too lazy to think that hard atm without prompting.
OK I got bored..... so here's some commands for ya..
ps x | grep <process name> | cut -f 2 will return the process number
and you can kill process number so then at the end I suppose you could just add | kill dunno if it accepts stdin tho... but i'm sure you can figure it out..
IT Blog: .:Computer Defense:.
(Pronounced Pinched): Acronym - Point 'n Click Hacked. As in: "That website was pinched" or "The skiddie pinched my computer because I forgot to patch".
July 1st, 2003, 07:50 AM
or you could download pstools from systernals.com run 'pslist -t' to get a tree view of processes running and in your script shell out to 'pskill processesname'
Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”
July 1st, 2003, 06:59 PM