JAVA2010. 9. 8. 17:57

import java.io.*;
public class SysInfo {
public static void main(String[] args) throws Exception
    {
        Process proc = null;
        BufferedReader procStdOut = null;
        try
        {
            // windows 폴더내의 systeminfo 파일을 읽어온다.
            proc = Runtime.getRuntime().exec("C:\\WINDOWS\\system32\\systeminfo");
            procStdOut = new BufferedReader(new InputStreamReader(proc.getInputStream()));
            String line;
            while (true)
            {
                line = procStdOut.readLine();
                if (line == null) break;

                System.out.println(line);
            }
        }
        catch (Exception e)
        {
            throw e;
        }
        finally
        {
            if (proc != null)
            proc.destroy(); // process를 kill시킨다.
            if (procStdOut != null)
            procStdOut.close();
        }
    }
} 

'JAVA' 카테고리의 다른 글

2진수 10진수로 변환  (0) 2010.09.09
10진수 2진수,8진수 변환  (0) 2010.09.09
JAVA 시스템 환경읽어오기  (0) 2010.09.08
JAVA Generic 예제  (0) 2010.08.12
JAVA 향상된 For문  (0) 2010.08.12
Posted by 달빛낙엽