久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

用JAVA與C#程序調(diào)用DOS命令PK

 really love 2010-07-01

用JAVA與C#程序調(diào)用DOS命令PK

 
 

1,、JAVA

package CmdTest;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class CmdTest {
 
 public static void main(String[] args) throws Throwable {
  // TODO Auto-generated method stub
  // 定義一個(gè)字符串用來(lái)輸出DOS命令的結(jié)果
  String strCmd;
  // 用來(lái)執(zhí)行DOS命令
  Process process = Runtime.getRuntime().exec("cmd /c netstat -an");
  // 將命令的結(jié)果以流的方式讀入
  BufferedReader bufferedReader = new BufferedReader(
    new InputStreamReader(process.getInputStream()));
  // 將結(jié)果循環(huán)打印輸出
  while ((strCmd = bufferedReader.readLine()) != null) {
   System.out.println(strCmd);
  }
  // 子線程結(jié)束后要?dú)⒌?br>  process.destroy();
 }

}

2、C#

        /// <summary>
        /// 備份文件
        /// </summary>
        /// <param name="scrPath"></param>
        /// <param name="desPath"></param>

        internal static void CopyDirectory(string scrPath, string desPath)
        {
            System.Diagnostics.Process process = new System.Diagnostics.Process();
            try
            {
                process.StartInfo.FileName = "XCopy";
                process.StartInfo.Arguments = string.Format(" \"{0}\" \"{1}\" /E/H/Y/I", scrPath, desPath);
                process.StartInfo.CreateNoWindow = true;
                process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                process.Start();
                process.WaitForExit();

            }
            catch
            {
                throw;
            }
            finally
            {
                process.Dispose();
                process = null;

            }
        }

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,,所有內(nèi)容均由用戶發(fā)布,,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購(gòu)買(mǎi)等信息,,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請(qǐng)點(diǎn)擊一鍵舉報(bào),。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多