Package applet;
Import java. Io. fileoutputstream;
Import java. Io. ioexception;
Import java. Io. inputstream;
Import java. Io. inputstreamreader;
/*
* This class displays the started Windows Services on the screen. Run the Net start command.
*/
Public class test {
Public static void main (string [] ARGs) throws ioexception {
PROCESS p = runtime.getruntime(cmd.exe C ("cmd.exe/C Net start ");
Inputstream is = P. getinputstream ();
Inputstreamreader ISR = NULL;
ISR = new inputstreamreader (is, "GBK"); // "UTF-8"
Int Len = ISR. Read ();
Byte [] buff = new byte [Len];
/**
* Convert byte array to char array
*/
String str2 = new string (buff );
Char [] CH2 = new char [str2.length ()];
For (INT I = 0; I <str2.length (); I ++ ){
CH2 [I] = str2.charat (I );
}
ISR. Read (CH2 );
Fileoutputstream Fos = new fileoutputstream ("C: // start.txt ");
/**
* Convert the char array to a byte array
*/
String STR = string. valueof (CH2, 0, ch2.length );
Byte [] alpha = Str. getbytes ();
FOS. Write (alpha );
System. Out. println (new string (alpha ));
}
}