visual studio c# stuck with ""

THOMAS WALL 1 Reputation point

sorry with vague title im struggling to make a program i need it to put arguments to cmd but i have more than one quote and keeps seeing links as strings? also im new to this

    private void Playbutton_Click(object sender, RoutedEventArgs e)
        System.Diagnostics.Process process = new System.Diagnostics.Process();
        System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
        startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
        startInfo.FileName = "cmd.exe";
        startInfo.Arguments =  (@"C:\Users\TheDu\Documents\Blox14M\Blox14M.exe -a "" -t  "1" -j  "");
        process.StartInfo = startInfo;


An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,640 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Daniel Zhang-MSFT 9,621 Reputation points

    Hi THOMASWALL-4990,
    First, you need to include the "/c" argument to tell cmd.exe what you mean it to do.

    startInfo.Arguments =  (@"/c C:\Users\TheDu\Documents\Blox14M\Blox14M.exe....")  

    In order to pass multiple command line arguments you should separate each with a space and surround it in quotes in case the argument itself contains a space.
    Code looks like:

    ProcessStartInfo startInfo = new ProcessStartInfo("cmd.exe");  
                startInfo.WindowStyle = ProcessWindowStyle.Hidden;  
             // Start with multiple arguments separated by spaces.  
                //  [0] = /a  
                //  [1] = /b  
                //  [2] = c:\temp  
                startInfo.Arguments = "/a /b c:\\temp";  

    More details you can refer to this document.
    Best Regards,
    Daniel Zhang

    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments