您的位置:首页 > Web前端 > Node.js

Atitit js nodejs下的进程管理wmic process进程管理

2017-02-03 13:39 686 查看
Atitit js nodejs下的进程管理wmic process进程管理

 

C:\Users\Administrator>wmic process get name

Name

System Idle Process

System

smss.exe

csrss.exe

wininit.exe

csrss.exe

services.exe

lsass.exe

lsm.exe

winlogon.exe

svchost.exe

ibmpmsvc.exe

svchost.exe

svchost.exe

Svchost.exe

 

Java的进程管理

- java的Runtime.getRuntime().exec(commandStr)可以调用执行cmd指令

java.lang.Runtime类
- 熔 岩 - 51CTO技术博客

 

 

Net的进程管理

 System.Diagnostics

 

Process 类

.NET Framework 2.0

其他版本

提供对本地和远程进程的访问并使您能够启动和停止本地系统进程。

命名空间:System.Diagnostics
程序集:System(在 system.dll 中)

 

 

Process 类

Visual Studio 2010

其他版本

提供对本地和远程进程的访问并使您能够启动和停止本地系统进程。

继承层次结构



System.Object

  System.MarshalByRefObject

    System.ComponentModel.Component

      System.Diagnostics.Process

命名空间:  System.Diagnostics
程序集:  System(在 System.dll 中)

 

 

D:\0workspace\atiplat_ee\com.attilax\core\process.js

/**

 * Created by Administrator on 2017/1/31.

 * ns process

 */

 

 

function Process()

{

 this.dbg=false;

}

//var Process = function(){}

 

 

Process.prototype.list=function()

{

    var cmd="";

    this.exec(cmd,function(line){

 

    },function(code){

 

    })

}

 

Process.prototype.exec=function(cmd,stdout_data_fun,exit_fun)

{

    var pM = require("../../com.attilax/io/path.js");

//    var cmd = 'D:\\0workspace\\Tesseract\\tesseract.exe "@jpg@"  "@rztName@" -l chi_sim';

 

   ;

    console.log('-----cmd data:' + cmd);

    var iconv = require('iconv-lite');

    var exec = require('child_process').exec;

    var exeHandler = exec(cmd, {

        encoding: "binary"

    });

 

    exeHandler.stdout.on('data', function (stdout_data) {

        var str = iconv.decode(stdout_data, 'GBK');

        if(this.dbg)

        console.log('-----stdout_data data:' + str);

        stdout_data_fun(str);

    });

//note ,if many data,,exit event maybe bef the data event ..,in many line data ret .should use timeout ..

    exeHandler.on('exit', function (code) {

        console.log('---exit code:' + code);

 

 

        exit_fun(code);

    });

}

 

 

Process.prototype.listNgrep=function(grepWord,retFun)

{

    var li=new Array();

    var cmd="wmic process get name";

 

    this.exec(cmd,function(lines){

        var a=lines.split("\r\n");

        for(idx in a)

        {

            var line=a[idx];

            line=line.replace("\r","");

            var logstr="line.indexOf_grepWord_, line:"+line;

            logstr+=", indexof:"+line.indexOf(grepWord);

            logstr+=", rzt:"+(line.indexOf(grepWord)>=0);

            console.log(logstr);

            var idx2=line.indexOf(grepWord);

            if(idx2>=0)

            {

                 console.log("--will add"+line);

                li.push(line);

            }else{}

 

        }

 

    },function(code){

      //  retFun(li);

        setTimeout(function(){

            retFun(li);

        },1000);

    });

 

}

 

 

try{

    module.exports.Process = Process;

 }catch(e)

{

 

}

 

作者:: 绰号:老哇的爪子claw of Eagle
偶像破坏者Iconoclast image-smasher

捕鸟王"Bird Catcher  kok  虔诚者Pious
宗教信仰捍卫者 Defender Of the Faith.
卡拉卡拉红斗篷 Caracalla red cloak
万兽之王

简称:: Emir Attilax Akbar
埃米尔 阿提拉克斯 阿克巴

全名::Emir Attilax Akbar bin Mahmud bin  attila bin Solomon bin adam Al Rapanui
埃米尔 阿提拉克斯 阿克巴 本 马哈茂德 本 阿提拉 本 所罗门 本亚当  阿尔 拉帕努伊

常用名:艾提拉(艾龙),  EMAIL:1466519819@qq.com

 

 

头衔:uke总部o2o负责人,全球网格化项目创始人,

uke宗教与文化融合事务部部长, uke宗教改革委员会副主席

Emir Uke部落首席大酋长,

uke制度与重大会议委员会委员长,uke保安部首席大队长,uke制度检查委员会副会长,

uke 首席cto  奶牛科技首席cto
, 软件部门总监 技术部副总监  研发部门总监主管  产品部副经理 项目部副经理

uke波利尼西亚区大区连锁负责人 汤加王国区域负责人 uke克尔格伦群岛区连锁负责人,莱恩群岛区连锁负责人,uke布维岛和南乔治亚和南桑威奇群岛大区连锁负责人

 Uke软件标准化协会理事长理事长 Uke
数据库与存储标准化协会副会长

 

uke终身教育学校副校长   Uke医院 与医学院方面的创始人

 Uke 户外运动协会理事长  度假村首席大村长  uke交友协会会长

 uke出版社编辑总编

 

转载请注明来源:attilax的专栏  ?http://blog.csdn.net/attilax

--Atiend  v4

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: