how to execute multiple cammand in command prompt using c#

前端 未结 2 1498
误落风尘
误落风尘 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();
    
    0 讨论(0)
  • 2021-01-14 03:13

    You need to set the parameter in the ProcessStartInfo.

    Example.

    Either set the Arguments Property

    Or use a different overload of the .Start() method.

    0 讨论(0)
提交回复
热议问题