none
Convert batch file to C# RRS feed

  • Question

  • Is it possible to convert a windows batch file to a C# console application?  Here is the batch file:

    Code Snippet

    @echo off
    
    lpr -S10.10.1.2 -Praw %1 -ol
    lpr -S10.10.1.3 -Praw %1 -ol
    lpr -S10.10.1.4 -Praw %1 -ol
    lpr -S10.10.1.5 -Praw %1 -ol
    pause







    • Edited by Furatxp Thursday, April 11, 2019 8:34 PM
    Thursday, April 11, 2019 8:30 PM

Answers

  • You can run the batch file using System.Diagnostics.Process.Start, or you can run the individual commands using the same method.  There are lots of examples of using the Process class.


    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Thursday, April 11, 2019 10:01 PM

All replies

  • You can run the batch file using System.Diagnostics.Process.Start, or you can run the individual commands using the same method.  There are lots of examples of using the Process class.


    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Thursday, April 11, 2019 10:01 PM
  • Hi

    Is your problem solved? If so, please post "Mark as answer" to the appropriate answer, so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, April 15, 2019 5:37 AM
    Moderator