System.DIagnostic.Process-command Invocation issue in non english OS RRS feed

  • Question

  • Hi,
    I have implementation where I run an exe through the command prompt using System.DIagnostic.Process.
    This works perfectly fine in english OS. However, to support multilingual- I have changed OS display language
    to French. When I run the same code, it does not do anything. However NO ERROR/EXCEPTION.When I compare the command parameter in
    both the languages, THEY ARE EXACTLY SAME. However, Non english does not do anything (command does not seems to be executed).

    Below is the sample code I used,

      Process pdfProcess = new Process();
      StreamWriter writer;
                    StreamReader reader;

                    ProcessStartInfo info = new ProcessStartInfo("cmd");

                    info.CreateNoWindow = true;
                    info.UseShellExecute = false;
                    info.RedirectStandardInput = true;
                    info.RedirectStandardOutput = true;
                    info.WindowStyle = ProcessWindowStyle.Hidden;
                    info.WorkingDirectory = exePath; //Path where Invoke exe located
                    pdfProcess.StartInfo = info;

                    writer = pdfProcess.StandardInput;
                    reader = pdfProcess.StandardOutput;
                    writer.AutoFlush = true;

                    string ret = reader.ReadToEnd();

    Any Idea what could be the solution?

    Wednesday, November 28, 2012 11:56 AM

All replies

  • This works perfectly fine here, on a French installation.

    Wednesday, November 28, 2012 4:28 PM
  • Hi Louis,

    Application uses parampters which has symbol "<". Will that be reason for the issue?

    Thursday, November 29, 2012 5:14 AM
  • cmd interprets < as an input redirection. Whatever the language.
    Thursday, November 29, 2012 1:01 PM
  • Hi,

    The issue is the file name. In non-english languages, special characters are getting added to the file name which is not getting executed by above code. For example:

    command = MyEXE.exe "C:\Sin título_ Bloc de notas.txt"

    If you see above (spanish), "í" text is causing the issue. If I remove it them command gets executed.

    Anyone has solution how to resove it?


    Sunday, December 2, 2012 11:41 AM
  • Then the problem is in MyEXE.exe.
    Monday, December 3, 2012 3:23 PM
  • Louis,

    MyExe.exe does not have any issue. If I execute the command directly from comman prompt - It works.

    This means, there should be some problem System.Diagnostic.Process.

    I even tried setting

    1. encoding for console :

    System.Console.InputEncoding = Encoding.UTF8;

    2. Stream Reader and Writer encoding.

    Any solution?

    Tuesday, December 4, 2012 11:51 AM
  • "From a support perspective this is really beyond what we can do here in the forums. If you cannot determine your answer here or on your own, consider opening a support case with us. Visit this link to see the various support options that are available to better meet your needs:;en-us;offerprophone."

    Carlos Lopez - Microsoft Escalation Engineer

    Thursday, December 13, 2012 2:58 AM