Setting function keys to perform action
I have scripting experience, but not any MS scripting languages. Don't really know where to start.
Thanks for any thoughts
You can use WScript.StdIn.Read or ReadLine and check the return string like so:
WScript.StdOut.Write("Please type a command key: ");
var key = WScript.StdIn.Read(1);
if (key == "k") WScript.Echo("Killing <process>");
To kill a process you can use WMI if the target computer supports it:
WScript.StdOut.Write("Please type a process name (with extension) to kill: ");
var name = WScript.StdIn.ReadLine();
var wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2");
var procs = wmi.ExecQuery("select * from Win32_Process where Name = '" + name + "'");
var e = new Enumerator(procs);
for (; !e.atEnd(); e.moveNext()) {
var proc = e.item();
WScript.Echo("Terminating process ID " + proc.ProcessId);
proc.Terminate();
}
You can find more scripting examples at http://www.microsoft.com/technet/scriptcenter/default.mspx.