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 8249447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:32:55+00:00 2026-06-07T23:32:55+00:00

From my previous question here I was writing a program that executes A number

  • 0

From my previous question here I was writing a program that executes A number of files through CMD.

Here is my Code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;
using System.Diagnostics;

namespace Convert
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
    }

    private void BtnSelect_Click(object sender, RoutedEventArgs e)
    {
        OpenFileDialog Open = new OpenFileDialog();
        Open.Filter = "RIFF/RIFX (*.Wav)|*.wav";
        Open.CheckFileExists = true;
        Open.Multiselect = true;
        Open.ShowDialog();
        LstFile.Items.Clear();
        foreach (string file in Open.FileNames)
        {
            LstFile.Items.Add(file);
        }
    }

    private void button1_Click(object sender, RoutedEventArgs e)
    {
        LstFile.Items.Clear();
    }

    private void BtnConvert_Click(object sender, RoutedEventArgs e)
    {       Process p = new Process();      
            p.StartInfo.FileName = "cmd";
            p.StartInfo.UseShellExecute = false;
            foreach (string fn in LstFile.Items)
            {
                string fil = "\"";
                string gn = fil + fn + fil;
                p.Start();
                p.StartInfo.Arguments = gn;
            }            
        }      
    }    
}

i used

string fil = "\"";
string gn = fil + fn + fil;

to provide quotation marks around the full file name in case the filename has spaces.

My problem is that my program Opens CMD Put does not pass any arguments in it.I checked if the filnames(list) are working and they are fine.Looking at the examples this is the way to do it,but obviously something is wrong

  • 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-07T23:32:57+00:00Added an answer on June 7, 2026 at 11:32 pm

    set

    StartInfo.Arguements 
    

    Before you start the process, and I’d suggest making a new process class for each process that you start.

    example:

    foreach (string fn in LstFile.Items)
    {
        string fil = "\"";
        string gn = fil + fn + fil;
    
        Process p = new Process();
        p.StartInfo.FileName = "cmd";
        p.StartInfo.UseShellExecute = false;
        p.StartInfo.Arguments = gn;
        //You can do other stuff with p.StartInfo such as redirecting the output
        p.Start();
        // i'd suggest adding p to a list or calling p.WaitForExit();, 
        //depending on your needs.  
    }
    

    If you’re trying to call cmd commands, make your arguements

    "/c \"what i would type into the command Line\""

    This is an example of what I did quick. It opens a text document in notepad

    Process p = new Process();
    p.StartInfo.FileName = "cmd";
    p.StartInfo.UseShellExecute = false;
    p.StartInfo.Arguments = "/c \"New Text Document.txt\"";
    p.Start();
    p.WaitForExit();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got the below code from an answer on a previous question here .
I'm trying to implement this algorithm description from a previous question I had here
From My Previous question sending request to apple - from iphone custom application Here,
From a previous question on Stackoverflow Iterating through/Parsing JSON Object via JavaScript .... My
After running code from my previous question , I get a result set from
This question follows on from a previous question, that has raised a further issue.
All, this is a follow up from a previous question here: C# formatting external
From my previous question for selecting specific html text, I have gone through this
This question follows on from a previous question which can be found here: Need
I have this function in R from a previous question here shift <- function(d,

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.