how to execute multiple cammand in command prompt using c#

前端 未结 2 1502
误落风尘
误落风尘 2021-01-14 02:46

I want to execute multiple commands as below:

cd C:\\Informatica\\9.0\\clients\\PowerCenterClient\\client\\bin

pmrep

connect -r rs_01_lab -d Domain_D

2条回答
  •  终归单人心
    2021-01-14 03:01

    In MS-DOS you can execute multiple commands in one line by separating the commands with an ampersand (&).

    String strCmdTxt = "/c cd C:\\Informatica\\9.0\\clients\\PowerCenterClient\\client\\bin & pmrep & connect -r rs_01_lab -d Domain_DELLBANPDB01 -n etl_designer -x etl123";
    ProcessStartInfo i = new ProcessStartInfo("cmd.exe", strCmdTxt);
    Process p = new Process();
    p.StartInfo = i;
    p.Start();
    

提交回复
热议问题