Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8642971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:54:53+00:00 2026-06-12T11:54:53+00:00

I am developing wpf application in C#. I am able to run the following

  • 0

I am developing wpf application in C#. I am able to run the following exe files

public static void GenerateCsvFile(string fileName)
        {
            System.Diagnostics.Process process = new System.Diagnostics.Process();
            System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
            startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
            startInfo.FileName = @"C:\ndfd\degrib\bin\degrib.exe";
            startInfo.Arguments = fileName +  " -C -msg 1 -Csv";
            process.StartInfo = startInfo;
            process.Start();

            System.Diagnostics.Process process1 = new System.Diagnostics.Process();
            System.Diagnostics.ProcessStartInfo startInfo1 = new System.Diagnostics.ProcessStartInfo();
            startInfo1.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
            startInfo1.FileName = @"C:\ndfd\degrib\bin\degrib.exe";
            startInfo1.Arguments = fileName + " -C -msg all -nMet -Csv";
            process1.StartInfo = startInfo1;
            process1.Start();
        }

The above code generate the csv files for me successfully. But .csv files are generated at different location depending on the fileName. means .csv files are generated within different folder each time. Can I force the exe to generate the .csv file in specific folder ? Can you please provide me any code or link through which I can resolve the above issue ?

Edit: The user selects the zip file and sumbit the form. The App.ApplicationPath is hard coded path. The following is my code

private void ShowPointsButton_Click(object sender, RoutedEventArgs e)
        {
            ZipHelper.UnZip(FileNameTextBox.Text, App.ApplicationPath, safeFileName, 9999999);
}




public static void UnZip(string SrcFile, string DstFile, string safeFileName, int bufferSize)
        {
            //ICSharpCode.SharpZipLib.Zip.UseZip64.Off;

            FileStream fileStreamIn = new FileStream(SrcFile, FileMode.Open, FileAccess.Read);

            ZipInputStream zipInStream = new ZipInputStream(fileStreamIn); ;
            //if (SrcFile.Contains(".bz2"))
            //{
            //BZip2InputStream zipInStream = new BZip2InputStream(fileStreamIn);
            //}
            //else
            //{
            //    zipInStream = new ZipInputStream(fileStreamIn);
            //}


            string rootDirectory = string.Empty;
            if (safeFileName.Contains(".zip"))
            {
                rootDirectory = safeFileName.Replace(".zip", string.Empty);
            }
            else
            {
                rootDirectory = safeFileName;
            }

            Directory.CreateDirectory(App.ApplicationPath + rootDirectory);

            while (true)
            {
                ZipEntry entry = zipInStream.GetNextEntry();

                if (entry == null)
                    break;

                if (entry.Name.Contains("/"))
                {
                    string[] folders = entry.Name.Split('/');

                    string lastElement = folders[folders.Length - 1];
                    var folderList = new List<string>(folders);
                    folderList.RemoveAt(folders.Length - 1);
                    folders = folderList.ToArray();

                    //string folderPath = "";
                    //foreach (string str in folders)
                    //{
                        //folderPath = folderPath + @"\" + str;
                        //string blackslash = folderPath.Substring(0, 1);

                        //if (blackslash == "\\")
                        //{
                        //    folderPath = folderPath.Remove(0, 1);
                        //}

                        //if (!Directory.Exists(App.ApplicationPath + rootDirectory + "/" + folderPath))
                        //{
                        //    Directory.CreateDirectory(App.ApplicationPath + rootDirectory + "/" + folderPath);
                        //}
                    //}

                    if (!string.IsNullOrEmpty(lastElement))
                    {
                        //folderPath = folderPath + @"\" + lastElement;

                        //string blackslash = folderPath.Substring(0, 1);

                        //if (blackslash == "\\")
                        //{
                        //    folderPath = folderPath.Remove(0, 1);
                        //}

                        WriteToFile(DstFile + rootDirectory + @"\" + lastElement, bufferSize, zipInStream, rootDirectory, entry);
                    }

                }
                else
                {
                    WriteToFile(DstFile + rootDirectory + @"\" + entry.Name, bufferSize, zipInStream, rootDirectory, entry);
                }
            }

            zipInStream.Close();
            fileStreamIn.Close();
        }

private static void WriteToFile(string DstFile, int bufferSize, ZipInputStream zipInStream, string rootDirectory, ZipEntry entry)
        {
            WriteFileContents(DstFile, bufferSize, zipInStream);

            if (DstFile.Contains(".grb"))
            {
                Utility.GenerateCsvFile(DstFile);
            }

            //if(DstFile.Contains(".csv"))
            //{
            //    WriteFileContents(@"D:\Documents" + rootDirectory + @"\" + entry.Name, bufferSize, zipInStream);
            //}
        }

        private static void WriteFileContents(string DstFile, int bufferSize, ZipInputStream zipInStream)
        {
            FileStream fileStreamOut = new FileStream(DstFile, FileMode.OpenOrCreate, FileAccess.Write);
            int size;
            byte[] buffer = new byte[bufferSize];

            do
            {
                size = zipInStream.Read(buffer, 0, buffer.Length);
                fileStreamOut.Write(buffer, 0, size);
            } while (size > 0);

            fileStreamOut.Close();
        }

In the above code see at line Utility.GenerateCsvFile(DstFile); I want to generate the .csv files at location ‘DstFile’. In short, the folder in which I am unzipping my files, in the same folder I want .exe to write .csv file. For example consider there is D:/XYZ folder in which I am unzipping my zip files. In this folder there is test.grib file. I want to run exe for test.grib and produce .csv files. I want these .csv files to be written to XYZ folder.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:54:54+00:00Added an answer on June 12, 2026 at 11:54 am

    processStartInfo.WorkingDirectory = @”Your Directory”;

    Please try this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a WPF application that must run using Windows Classic theme. The
I am developing wpf application. I have one static world map of 500 width
I am developing wpf application in C#. I am using grib files in my
I am developing wpf application. I am using sharpziplib to compress and decompress files.
I am developing a WPF application, that connects to several WCF services (that work
Context: I'm developing a WPF application which will contain a lot of different screens.
I am developing a WPF application, and I need your advice. I have to
I am developing a WPF application that must meet Section 508 (Accessibility) requirements. In
We are developing a WPF application which uses Telerik's suite of controls and everything
I'm developing a WPF application which reads and writes XML data. I'm coming from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.