Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
816 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 Reply

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...