不灭的火

加密类型:SHA/AES/RSA下载Go
复合类型:切片(slice)、映射(map)、指针(pointer)、函数(function)、通道(channel)、接口(interface)、数组(array)、结构体(struct) Go类型+零值nil
引用类型:切片(slice)、映射(map)、指针(pointer)、函数(function)、通道(channel) Go引用

作者:AlbertWen  添加时间:2018-09-17 16:33:12  修改时间:2025-10-23 12:01:52  分类:08.Java基础  编辑
public static void main(String[] args) {
    String keyWord = "chrome.exe";

    Runtime runtime = Runtime.getRuntime();

    try {
        Process process = runtime.exec("cmd /c Tasklist");

        BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));

        String s;
        while ((s = in.readLine()) != null) {
            s = s.toLowerCase();
            if (s.startsWith(keyWord)) {
                System.out.println("==========>" + keyWord);
                break;
            }
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}