Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
813 views
in Technique[技术] by (71.8m points)

process - Javascript to get running processes?

I'm wondering if it's possible to use Javascript in a web browser (most likely IE) to retrieve a list of currently running processes?

I'm not trying to start any processes or close them or anything like that. Just a list that I can check through then say for example do something else if a certain process is running.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Here is JSP page-

<html>
<head>
<title>Find running processes</title>
<script type="text/jscript">
function getProcessList()
{
  var procs = GetObject("WinMgmts:").InstancesOf("Win32_Process");
  var mainRes = "";
  procEnum = new Enumerator(procs);
  for ( ; !procEnum.atEnd(); procEnum.moveNext())
  {
    var proc = procEnum.item();   
    mainRes += proc.Name + ": " + proc.ProcessID + "
";
  } 
  return mainRes;
}

function getSysRunningApps()
{
  var oOutput = document.getElementById("processDisplay");
  oOutput.value = "";
  oOutput.value = getProcessList();
}

</script>
</head>

<body bgcolor="#FFFFFF">
<input type="button" value="Show Processes" onclick="getSysRunningApps();"><br>
<p id="processDisplay" cols="30" rows="40"></p>
</body>
</html>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...