c# open file with default application and parameters












78















The most easy way to open a file with the default application is:



System.Diagnostics.Process.Start(@"c:myPDF.pdf");


However, I would like to know if exists a way to set parameters to the default application, because I would like to open a pdf in a determinate page number.



I know how can I do it creating a new process and set the parameters, but in this way I need to indicate the path of the application, and I would like to have a portable application and not to have to set the path of the applications each time I use the application in other computer. My idea is that I expect that the computer has installed the pdf reader and only say what page open.



Thanks.










share|improve this question























  • Do you mean send parameters to the Adobe executable rather than the pdf file, but without using the full path?

    – Bali C
    Jul 6 '12 at 16:19






  • 2





    How do you expect this to work? If you do not know the path of the application, you do not know which is the default PDF viewer, and you don't know which parameter format to use.

    – ken2k
    Jul 6 '12 at 16:20






  • 2





    Isn't enough to say myProcess.StartInfo.FileName = "Acrobat.exe"; without giving the full path to the application?

    – daniloquio
    Jul 6 '12 at 16:23






  • 1





    Take a look at this SO question to see it helps

    – Mark Hall
    Jul 6 '12 at 16:25






  • 2





    @daniloquio: I think the point is that the OP doesn't know what the end user has installed on his/her machine to read adobe files with, it could be Acrobat, Acrobat Reader, or something else.

    – Surfbutler
    Jul 6 '12 at 16:28
















78















The most easy way to open a file with the default application is:



System.Diagnostics.Process.Start(@"c:myPDF.pdf");


However, I would like to know if exists a way to set parameters to the default application, because I would like to open a pdf in a determinate page number.



I know how can I do it creating a new process and set the parameters, but in this way I need to indicate the path of the application, and I would like to have a portable application and not to have to set the path of the applications each time I use the application in other computer. My idea is that I expect that the computer has installed the pdf reader and only say what page open.



Thanks.










share|improve this question























  • Do you mean send parameters to the Adobe executable rather than the pdf file, but without using the full path?

    – Bali C
    Jul 6 '12 at 16:19






  • 2





    How do you expect this to work? If you do not know the path of the application, you do not know which is the default PDF viewer, and you don't know which parameter format to use.

    – ken2k
    Jul 6 '12 at 16:20






  • 2





    Isn't enough to say myProcess.StartInfo.FileName = "Acrobat.exe"; without giving the full path to the application?

    – daniloquio
    Jul 6 '12 at 16:23






  • 1





    Take a look at this SO question to see it helps

    – Mark Hall
    Jul 6 '12 at 16:25






  • 2





    @daniloquio: I think the point is that the OP doesn't know what the end user has installed on his/her machine to read adobe files with, it could be Acrobat, Acrobat Reader, or something else.

    – Surfbutler
    Jul 6 '12 at 16:28














78












78








78


20






The most easy way to open a file with the default application is:



System.Diagnostics.Process.Start(@"c:myPDF.pdf");


However, I would like to know if exists a way to set parameters to the default application, because I would like to open a pdf in a determinate page number.



I know how can I do it creating a new process and set the parameters, but in this way I need to indicate the path of the application, and I would like to have a portable application and not to have to set the path of the applications each time I use the application in other computer. My idea is that I expect that the computer has installed the pdf reader and only say what page open.



Thanks.










share|improve this question














The most easy way to open a file with the default application is:



System.Diagnostics.Process.Start(@"c:myPDF.pdf");


However, I would like to know if exists a way to set parameters to the default application, because I would like to open a pdf in a determinate page number.



I know how can I do it creating a new process and set the parameters, but in this way I need to indicate the path of the application, and I would like to have a portable application and not to have to set the path of the applications each time I use the application in other computer. My idea is that I expect that the computer has installed the pdf reader and only say what page open.



Thanks.







c# file






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jul 6 '12 at 16:15









Álvaro GarcíaÁlvaro García

6,4301962116




6,4301962116













  • Do you mean send parameters to the Adobe executable rather than the pdf file, but without using the full path?

    – Bali C
    Jul 6 '12 at 16:19






  • 2





    How do you expect this to work? If you do not know the path of the application, you do not know which is the default PDF viewer, and you don't know which parameter format to use.

    – ken2k
    Jul 6 '12 at 16:20






  • 2





    Isn't enough to say myProcess.StartInfo.FileName = "Acrobat.exe"; without giving the full path to the application?

    – daniloquio
    Jul 6 '12 at 16:23






  • 1





    Take a look at this SO question to see it helps

    – Mark Hall
    Jul 6 '12 at 16:25






  • 2





    @daniloquio: I think the point is that the OP doesn't know what the end user has installed on his/her machine to read adobe files with, it could be Acrobat, Acrobat Reader, or something else.

    – Surfbutler
    Jul 6 '12 at 16:28



















  • Do you mean send parameters to the Adobe executable rather than the pdf file, but without using the full path?

    – Bali C
    Jul 6 '12 at 16:19






  • 2





    How do you expect this to work? If you do not know the path of the application, you do not know which is the default PDF viewer, and you don't know which parameter format to use.

    – ken2k
    Jul 6 '12 at 16:20






  • 2





    Isn't enough to say myProcess.StartInfo.FileName = "Acrobat.exe"; without giving the full path to the application?

    – daniloquio
    Jul 6 '12 at 16:23






  • 1





    Take a look at this SO question to see it helps

    – Mark Hall
    Jul 6 '12 at 16:25






  • 2





    @daniloquio: I think the point is that the OP doesn't know what the end user has installed on his/her machine to read adobe files with, it could be Acrobat, Acrobat Reader, or something else.

    – Surfbutler
    Jul 6 '12 at 16:28

















Do you mean send parameters to the Adobe executable rather than the pdf file, but without using the full path?

– Bali C
Jul 6 '12 at 16:19





Do you mean send parameters to the Adobe executable rather than the pdf file, but without using the full path?

– Bali C
Jul 6 '12 at 16:19




2




2





How do you expect this to work? If you do not know the path of the application, you do not know which is the default PDF viewer, and you don't know which parameter format to use.

– ken2k
Jul 6 '12 at 16:20





How do you expect this to work? If you do not know the path of the application, you do not know which is the default PDF viewer, and you don't know which parameter format to use.

– ken2k
Jul 6 '12 at 16:20




2




2





Isn't enough to say myProcess.StartInfo.FileName = "Acrobat.exe"; without giving the full path to the application?

– daniloquio
Jul 6 '12 at 16:23





Isn't enough to say myProcess.StartInfo.FileName = "Acrobat.exe"; without giving the full path to the application?

– daniloquio
Jul 6 '12 at 16:23




1




1





Take a look at this SO question to see it helps

– Mark Hall
Jul 6 '12 at 16:25





Take a look at this SO question to see it helps

– Mark Hall
Jul 6 '12 at 16:25




2




2





@daniloquio: I think the point is that the OP doesn't know what the end user has installed on his/her machine to read adobe files with, it could be Acrobat, Acrobat Reader, or something else.

– Surfbutler
Jul 6 '12 at 16:28





@daniloquio: I think the point is that the OP doesn't know what the end user has installed on his/her machine to read adobe files with, it could be Acrobat, Acrobat Reader, or something else.

– Surfbutler
Jul 6 '12 at 16:28












5 Answers
5






active

oldest

votes


















36














EDIT (thanks to surfbutler comment in the question comments)
If you want the file to be opened with the default application, I mean without specifying Acrobat or Reader, you can't open the file in the specified page.



On the other hand, if you are Ok with specifying Acrobat or Reader, keep reading:





You can do it without telling the full Acrobat path, like this:



Process myProcess = new Process();    
myProcess.StartInfo.FileName = "acroRd32.exe"; //not the full application path
myProcess.StartInfo.Arguments = "/A "page=2=OpenActions" C:\example.pdf";
myProcess.Start();


If you don't want the pdf to open with Reader but with Acrobat, chage the second line like this:



myProcess.StartInfo.FileName = "Acrobat.exe";


SECOND EDIT: Finding the default application for the pdf extension



You can query the registry to identify the default application to open pdf files and then define FileName on your process's StartInfo accordingly. Again, thanks surfbutler for your comment :)



Follow this question for details on doing that: Finding the default application for opening a particular file type on Windows






share|improve this answer





















  • 2





    +1 Also I think it's possible to look up the application associated with any file type e.g. '.pdf' in the registry, then put that name in the filename parameter. See stackoverflow.com/questions/162331/…

    – Surfbutler
    Jul 6 '12 at 16:38













  • Is there some open parameter to get Adobe reader to open in 2-page view? Just curious, if someone knows, that would be real useful. I've been looking around, but I can't find anything.

    – taki Martillo
    Nov 6 '14 at 16:02



















7














I converted the VB code in the blog post linked by xsl to C# and modified it a bit:



public static bool TryGetRegisteredApplication(
string extension, out string registeredApp)
{
string extensionId = GetClassesRootKeyDefaultValue(extension);
if (extensionId == null)
{
registeredApp = null;
return false;
}

string openCommand = GetClassesRootKeyDefaultValue(
Path.Combine(new {extensionId, "shell", "open", "command"}));

if (openCommand == null)
{
registeredApp = null;
return false;
}

registeredApp = openCommand
.Replace("%1", string.Empty)
.Replace(""", string.Empty)
.Trim();
return true;
}

private static string GetClassesRootKeyDefaultValue(string keyPath)
{
using (var key = Registry.ClassesRoot.OpenSubKey(keyPath))
{
if (key == null)
{
return null;
}

var defaultValue = key.GetValue(null);
if (defaultValue == null)
{
return null;
}

return defaultValue.ToString();
}
}


EDIT - this is unreliable. See Finding the default application for opening a particular file type on Windows.






share|improve this answer

































    3














    you can try with



    Process process = new Process();
    process.StartInfo.FileName = "yourProgram.exe";
    process.StartInfo.Arguments = ..... //your parameters
    process.Start();





    share|improve this answer































      0














      this should be close!



      public static void OpenWithDefaultProgram(string path)
      {
      Process fileopener = new Process();
      fileopener.StartInfo.FileName = "explorer";
      fileopener.StartInfo.Arguments = """ + path + """;
      fileopener.Start();
      }





      share|improve this answer

































        -5














        Please add Settings under Properties for the Project and make use of them this way you have clean and easy configurable settings that can be configured as default



        How To: Create a New Setting at Design Time



        Update: after comments below





        1. Right + Click on project

        2. Add New Item

        3. Under Visual C# Items -> General

        4. Select Settings File







        share|improve this answer





















        • 11





          Wrong tab maybe? ;)

          – ken2k
          Jul 6 '12 at 16:25











        Your Answer






        StackExchange.ifUsing("editor", function () {
        StackExchange.using("externalEditor", function () {
        StackExchange.using("snippets", function () {
        StackExchange.snippets.init();
        });
        });
        }, "code-snippets");

        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "1"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f11365984%2fc-sharp-open-file-with-default-application-and-parameters%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        5 Answers
        5






        active

        oldest

        votes








        5 Answers
        5






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        36














        EDIT (thanks to surfbutler comment in the question comments)
        If you want the file to be opened with the default application, I mean without specifying Acrobat or Reader, you can't open the file in the specified page.



        On the other hand, if you are Ok with specifying Acrobat or Reader, keep reading:





        You can do it without telling the full Acrobat path, like this:



        Process myProcess = new Process();    
        myProcess.StartInfo.FileName = "acroRd32.exe"; //not the full application path
        myProcess.StartInfo.Arguments = "/A "page=2=OpenActions" C:\example.pdf";
        myProcess.Start();


        If you don't want the pdf to open with Reader but with Acrobat, chage the second line like this:



        myProcess.StartInfo.FileName = "Acrobat.exe";


        SECOND EDIT: Finding the default application for the pdf extension



        You can query the registry to identify the default application to open pdf files and then define FileName on your process's StartInfo accordingly. Again, thanks surfbutler for your comment :)



        Follow this question for details on doing that: Finding the default application for opening a particular file type on Windows






        share|improve this answer





















        • 2





          +1 Also I think it's possible to look up the application associated with any file type e.g. '.pdf' in the registry, then put that name in the filename parameter. See stackoverflow.com/questions/162331/…

          – Surfbutler
          Jul 6 '12 at 16:38













        • Is there some open parameter to get Adobe reader to open in 2-page view? Just curious, if someone knows, that would be real useful. I've been looking around, but I can't find anything.

          – taki Martillo
          Nov 6 '14 at 16:02
















        36














        EDIT (thanks to surfbutler comment in the question comments)
        If you want the file to be opened with the default application, I mean without specifying Acrobat or Reader, you can't open the file in the specified page.



        On the other hand, if you are Ok with specifying Acrobat or Reader, keep reading:





        You can do it without telling the full Acrobat path, like this:



        Process myProcess = new Process();    
        myProcess.StartInfo.FileName = "acroRd32.exe"; //not the full application path
        myProcess.StartInfo.Arguments = "/A "page=2=OpenActions" C:\example.pdf";
        myProcess.Start();


        If you don't want the pdf to open with Reader but with Acrobat, chage the second line like this:



        myProcess.StartInfo.FileName = "Acrobat.exe";


        SECOND EDIT: Finding the default application for the pdf extension



        You can query the registry to identify the default application to open pdf files and then define FileName on your process's StartInfo accordingly. Again, thanks surfbutler for your comment :)



        Follow this question for details on doing that: Finding the default application for opening a particular file type on Windows






        share|improve this answer





















        • 2





          +1 Also I think it's possible to look up the application associated with any file type e.g. '.pdf' in the registry, then put that name in the filename parameter. See stackoverflow.com/questions/162331/…

          – Surfbutler
          Jul 6 '12 at 16:38













        • Is there some open parameter to get Adobe reader to open in 2-page view? Just curious, if someone knows, that would be real useful. I've been looking around, but I can't find anything.

          – taki Martillo
          Nov 6 '14 at 16:02














        36












        36








        36







        EDIT (thanks to surfbutler comment in the question comments)
        If you want the file to be opened with the default application, I mean without specifying Acrobat or Reader, you can't open the file in the specified page.



        On the other hand, if you are Ok with specifying Acrobat or Reader, keep reading:





        You can do it without telling the full Acrobat path, like this:



        Process myProcess = new Process();    
        myProcess.StartInfo.FileName = "acroRd32.exe"; //not the full application path
        myProcess.StartInfo.Arguments = "/A "page=2=OpenActions" C:\example.pdf";
        myProcess.Start();


        If you don't want the pdf to open with Reader but with Acrobat, chage the second line like this:



        myProcess.StartInfo.FileName = "Acrobat.exe";


        SECOND EDIT: Finding the default application for the pdf extension



        You can query the registry to identify the default application to open pdf files and then define FileName on your process's StartInfo accordingly. Again, thanks surfbutler for your comment :)



        Follow this question for details on doing that: Finding the default application for opening a particular file type on Windows






        share|improve this answer















        EDIT (thanks to surfbutler comment in the question comments)
        If you want the file to be opened with the default application, I mean without specifying Acrobat or Reader, you can't open the file in the specified page.



        On the other hand, if you are Ok with specifying Acrobat or Reader, keep reading:





        You can do it without telling the full Acrobat path, like this:



        Process myProcess = new Process();    
        myProcess.StartInfo.FileName = "acroRd32.exe"; //not the full application path
        myProcess.StartInfo.Arguments = "/A "page=2=OpenActions" C:\example.pdf";
        myProcess.Start();


        If you don't want the pdf to open with Reader but with Acrobat, chage the second line like this:



        myProcess.StartInfo.FileName = "Acrobat.exe";


        SECOND EDIT: Finding the default application for the pdf extension



        You can query the registry to identify the default application to open pdf files and then define FileName on your process's StartInfo accordingly. Again, thanks surfbutler for your comment :)



        Follow this question for details on doing that: Finding the default application for opening a particular file type on Windows







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Aug 14 '17 at 8:26









        Hakam Fostok

        5,41484366




        5,41484366










        answered Jul 6 '12 at 16:25









        daniloquiodaniloquio

        3,00612649




        3,00612649








        • 2





          +1 Also I think it's possible to look up the application associated with any file type e.g. '.pdf' in the registry, then put that name in the filename parameter. See stackoverflow.com/questions/162331/…

          – Surfbutler
          Jul 6 '12 at 16:38













        • Is there some open parameter to get Adobe reader to open in 2-page view? Just curious, if someone knows, that would be real useful. I've been looking around, but I can't find anything.

          – taki Martillo
          Nov 6 '14 at 16:02














        • 2





          +1 Also I think it's possible to look up the application associated with any file type e.g. '.pdf' in the registry, then put that name in the filename parameter. See stackoverflow.com/questions/162331/…

          – Surfbutler
          Jul 6 '12 at 16:38













        • Is there some open parameter to get Adobe reader to open in 2-page view? Just curious, if someone knows, that would be real useful. I've been looking around, but I can't find anything.

          – taki Martillo
          Nov 6 '14 at 16:02








        2




        2





        +1 Also I think it's possible to look up the application associated with any file type e.g. '.pdf' in the registry, then put that name in the filename parameter. See stackoverflow.com/questions/162331/…

        – Surfbutler
        Jul 6 '12 at 16:38







        +1 Also I think it's possible to look up the application associated with any file type e.g. '.pdf' in the registry, then put that name in the filename parameter. See stackoverflow.com/questions/162331/…

        – Surfbutler
        Jul 6 '12 at 16:38















        Is there some open parameter to get Adobe reader to open in 2-page view? Just curious, if someone knows, that would be real useful. I've been looking around, but I can't find anything.

        – taki Martillo
        Nov 6 '14 at 16:02





        Is there some open parameter to get Adobe reader to open in 2-page view? Just curious, if someone knows, that would be real useful. I've been looking around, but I can't find anything.

        – taki Martillo
        Nov 6 '14 at 16:02













        7














        I converted the VB code in the blog post linked by xsl to C# and modified it a bit:



        public static bool TryGetRegisteredApplication(
        string extension, out string registeredApp)
        {
        string extensionId = GetClassesRootKeyDefaultValue(extension);
        if (extensionId == null)
        {
        registeredApp = null;
        return false;
        }

        string openCommand = GetClassesRootKeyDefaultValue(
        Path.Combine(new {extensionId, "shell", "open", "command"}));

        if (openCommand == null)
        {
        registeredApp = null;
        return false;
        }

        registeredApp = openCommand
        .Replace("%1", string.Empty)
        .Replace(""", string.Empty)
        .Trim();
        return true;
        }

        private static string GetClassesRootKeyDefaultValue(string keyPath)
        {
        using (var key = Registry.ClassesRoot.OpenSubKey(keyPath))
        {
        if (key == null)
        {
        return null;
        }

        var defaultValue = key.GetValue(null);
        if (defaultValue == null)
        {
        return null;
        }

        return defaultValue.ToString();
        }
        }


        EDIT - this is unreliable. See Finding the default application for opening a particular file type on Windows.






        share|improve this answer






























          7














          I converted the VB code in the blog post linked by xsl to C# and modified it a bit:



          public static bool TryGetRegisteredApplication(
          string extension, out string registeredApp)
          {
          string extensionId = GetClassesRootKeyDefaultValue(extension);
          if (extensionId == null)
          {
          registeredApp = null;
          return false;
          }

          string openCommand = GetClassesRootKeyDefaultValue(
          Path.Combine(new {extensionId, "shell", "open", "command"}));

          if (openCommand == null)
          {
          registeredApp = null;
          return false;
          }

          registeredApp = openCommand
          .Replace("%1", string.Empty)
          .Replace(""", string.Empty)
          .Trim();
          return true;
          }

          private static string GetClassesRootKeyDefaultValue(string keyPath)
          {
          using (var key = Registry.ClassesRoot.OpenSubKey(keyPath))
          {
          if (key == null)
          {
          return null;
          }

          var defaultValue = key.GetValue(null);
          if (defaultValue == null)
          {
          return null;
          }

          return defaultValue.ToString();
          }
          }


          EDIT - this is unreliable. See Finding the default application for opening a particular file type on Windows.






          share|improve this answer




























            7












            7








            7







            I converted the VB code in the blog post linked by xsl to C# and modified it a bit:



            public static bool TryGetRegisteredApplication(
            string extension, out string registeredApp)
            {
            string extensionId = GetClassesRootKeyDefaultValue(extension);
            if (extensionId == null)
            {
            registeredApp = null;
            return false;
            }

            string openCommand = GetClassesRootKeyDefaultValue(
            Path.Combine(new {extensionId, "shell", "open", "command"}));

            if (openCommand == null)
            {
            registeredApp = null;
            return false;
            }

            registeredApp = openCommand
            .Replace("%1", string.Empty)
            .Replace(""", string.Empty)
            .Trim();
            return true;
            }

            private static string GetClassesRootKeyDefaultValue(string keyPath)
            {
            using (var key = Registry.ClassesRoot.OpenSubKey(keyPath))
            {
            if (key == null)
            {
            return null;
            }

            var defaultValue = key.GetValue(null);
            if (defaultValue == null)
            {
            return null;
            }

            return defaultValue.ToString();
            }
            }


            EDIT - this is unreliable. See Finding the default application for opening a particular file type on Windows.






            share|improve this answer















            I converted the VB code in the blog post linked by xsl to C# and modified it a bit:



            public static bool TryGetRegisteredApplication(
            string extension, out string registeredApp)
            {
            string extensionId = GetClassesRootKeyDefaultValue(extension);
            if (extensionId == null)
            {
            registeredApp = null;
            return false;
            }

            string openCommand = GetClassesRootKeyDefaultValue(
            Path.Combine(new {extensionId, "shell", "open", "command"}));

            if (openCommand == null)
            {
            registeredApp = null;
            return false;
            }

            registeredApp = openCommand
            .Replace("%1", string.Empty)
            .Replace(""", string.Empty)
            .Trim();
            return true;
            }

            private static string GetClassesRootKeyDefaultValue(string keyPath)
            {
            using (var key = Registry.ClassesRoot.OpenSubKey(keyPath))
            {
            if (key == null)
            {
            return null;
            }

            var defaultValue = key.GetValue(null);
            if (defaultValue == null)
            {
            return null;
            }

            return defaultValue.ToString();
            }
            }


            EDIT - this is unreliable. See Finding the default application for opening a particular file type on Windows.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited May 23 '17 at 12:10









            Community

            11




            11










            answered Jul 21 '13 at 14:47









            Ohad SchneiderOhad Schneider

            26.4k10121157




            26.4k10121157























                3














                you can try with



                Process process = new Process();
                process.StartInfo.FileName = "yourProgram.exe";
                process.StartInfo.Arguments = ..... //your parameters
                process.Start();





                share|improve this answer




























                  3














                  you can try with



                  Process process = new Process();
                  process.StartInfo.FileName = "yourProgram.exe";
                  process.StartInfo.Arguments = ..... //your parameters
                  process.Start();





                  share|improve this answer


























                    3












                    3








                    3







                    you can try with



                    Process process = new Process();
                    process.StartInfo.FileName = "yourProgram.exe";
                    process.StartInfo.Arguments = ..... //your parameters
                    process.Start();





                    share|improve this answer













                    you can try with



                    Process process = new Process();
                    process.StartInfo.FileName = "yourProgram.exe";
                    process.StartInfo.Arguments = ..... //your parameters
                    process.Start();






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jul 6 '12 at 16:18









                    Aghilas YakoubAghilas Yakoub

                    24.4k43038




                    24.4k43038























                        0














                        this should be close!



                        public static void OpenWithDefaultProgram(string path)
                        {
                        Process fileopener = new Process();
                        fileopener.StartInfo.FileName = "explorer";
                        fileopener.StartInfo.Arguments = """ + path + """;
                        fileopener.Start();
                        }





                        share|improve this answer






























                          0














                          this should be close!



                          public static void OpenWithDefaultProgram(string path)
                          {
                          Process fileopener = new Process();
                          fileopener.StartInfo.FileName = "explorer";
                          fileopener.StartInfo.Arguments = """ + path + """;
                          fileopener.Start();
                          }





                          share|improve this answer




























                            0












                            0








                            0







                            this should be close!



                            public static void OpenWithDefaultProgram(string path)
                            {
                            Process fileopener = new Process();
                            fileopener.StartInfo.FileName = "explorer";
                            fileopener.StartInfo.Arguments = """ + path + """;
                            fileopener.Start();
                            }





                            share|improve this answer















                            this should be close!



                            public static void OpenWithDefaultProgram(string path)
                            {
                            Process fileopener = new Process();
                            fileopener.StartInfo.FileName = "explorer";
                            fileopener.StartInfo.Arguments = """ + path + """;
                            fileopener.Start();
                            }






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Jan 20 at 11:33

























                            answered Jan 20 at 9:27









                            jessie tessiejessie tessie

                            11




                            11























                                -5














                                Please add Settings under Properties for the Project and make use of them this way you have clean and easy configurable settings that can be configured as default



                                How To: Create a New Setting at Design Time



                                Update: after comments below





                                1. Right + Click on project

                                2. Add New Item

                                3. Under Visual C# Items -> General

                                4. Select Settings File







                                share|improve this answer





















                                • 11





                                  Wrong tab maybe? ;)

                                  – ken2k
                                  Jul 6 '12 at 16:25
















                                -5














                                Please add Settings under Properties for the Project and make use of them this way you have clean and easy configurable settings that can be configured as default



                                How To: Create a New Setting at Design Time



                                Update: after comments below





                                1. Right + Click on project

                                2. Add New Item

                                3. Under Visual C# Items -> General

                                4. Select Settings File







                                share|improve this answer





















                                • 11





                                  Wrong tab maybe? ;)

                                  – ken2k
                                  Jul 6 '12 at 16:25














                                -5












                                -5








                                -5







                                Please add Settings under Properties for the Project and make use of them this way you have clean and easy configurable settings that can be configured as default



                                How To: Create a New Setting at Design Time



                                Update: after comments below





                                1. Right + Click on project

                                2. Add New Item

                                3. Under Visual C# Items -> General

                                4. Select Settings File







                                share|improve this answer















                                Please add Settings under Properties for the Project and make use of them this way you have clean and easy configurable settings that can be configured as default



                                How To: Create a New Setting at Design Time



                                Update: after comments below





                                1. Right + Click on project

                                2. Add New Item

                                3. Under Visual C# Items -> General

                                4. Select Settings File








                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Jul 6 '12 at 17:03

























                                answered Jul 6 '12 at 16:24









                                HatSoftHatSoft

                                9,63231943




                                9,63231943








                                • 11





                                  Wrong tab maybe? ;)

                                  – ken2k
                                  Jul 6 '12 at 16:25














                                • 11





                                  Wrong tab maybe? ;)

                                  – ken2k
                                  Jul 6 '12 at 16:25








                                11




                                11





                                Wrong tab maybe? ;)

                                – ken2k
                                Jul 6 '12 at 16:25





                                Wrong tab maybe? ;)

                                – ken2k
                                Jul 6 '12 at 16:25


















                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f11365984%2fc-sharp-open-file-with-default-application-and-parameters%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Homophylophilia

                                Updating UILabel text programmatically using a function

                                Cloud Functions - OpenCV Videocapture Read method fails for larger files from cloud storage