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

  • Home
  • SEARCH
  • 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 6253459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:59:52+00:00 2026-05-24T13:59:52+00:00

:) I have a software which can be executed via command line, and now

  • 0

🙂

I have a software which can be executed via command line, and now I want it to be executed directly from my C# app. Sadly, there is no error but I still can’t do it. 🙁

The path of .exe file of the software is C:\program files\mysoftware.exe

The command I would like to input is
cd c:\program files\mysoftwareFolder
enter
mysoftware.exe d:\myfolder\file1.xxx d:\myfolder\file2.xxx -mycommand
enter
exit

The commands above work so well in the actual command prompt, but they just don’t work from my C# code.

Here is the code:

        Process cmdprocess = new Process();
        System.Diagnostics.ProcessStartInfo startinfo = new System.Diagnostics.ProcessStartInfo();
        startinfo.FileName = "cmd";
        startinfo.WindowStyle = ProcessWindowStyle.Hidden;
        startinfo.CreateNoWindow = true;
        startinfo.RedirectStandardInput = true;
        startinfo.RedirectStandardOutput = true;
        startinfo.UseShellExecute = false;
        cmdprocess.StartInfo = startinfo;
        cmdprocess.Start();
        System.IO.StreamReader sr = cmdprocess.StandardOutput;
        System.IO.StreamWriter sw = cmdprocess.StandardInput;
        sw.WriteLine(@"echo on");
        sw.WriteLine(@"c:");
        sw.WriteLine(@"cd" +@"program files\mysoftwarefolder");
        sw.WriteLine(@"mysoftware.exe" +@"d:\myfolder\file1.xxx" +@"d:\myfolder\file2.xxx" +@"-mycommand");
        sw.WriteLine(@"exit");
        sw.Close();
        sr.Close();

I guess the incorrect parts might be “startinfo.FileName = “cmd”;” or the way I typed the command in the code, but I have no idea how to correct them. 🙁

Please tell me what I did wrong. I appreciate every answer from you! :)))

UPDATE Thank you for your helps! I tried writing the command in batch file, but it only works in debugging mode. (I forgot to tell you guys that I am developing a web service.) When I run my external project which will use this C# service, it won’t work. I don’t know whether I should add something to my code or not.

help meeeeee pleaseeeee (T___T)

  • 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-05-24T13:59:53+00:00Added an answer on May 24, 2026 at 1:59 pm

    Write these commands in a batch file and execute the batch file.

    In batch file:

    cd c:\program files\mysoftwareFolder 
    mysoftware.exe
    d:\myfolder\file1.xxx
    d:\myfolder\file2.xxx -mycommand 
    exit
    

    Code:

    Process cmdprocess = new Process();
    ProcessStartInfo startinfo = new ProcessStartInfo();
    startinfo.FileName = "path to batchfile.bat";
    startinfo.WindowStyle = ProcessWindowStyle.Hidden;
    startinfo.CreateNoWindow = true;
    startinfo.RedirectStandardInput = true;
    startinfo.RedirectStandardOutput = true;
    startinfo.UseShellExecute = false;
    cmdprocess.StartInfo = startinfo;
    cmdprocess.Start();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have some software we use internally which is released via ClickOnce from VS
We have some software which relied on certain behavior from another ( very commonly
There are numerous Agile software development methods. Which ones have you used in practice
I have a piece of software which is linked against several libraries. They all
I have the situation where i use GIS software which stores the information about
I have a software diagnostic page on which I would like to list the
I have a distributed application which polls for commands from a central server and
We have a software product that evolves at the rhythm of clients' needs and
I am doing 2nd year computer science and we have a software engineering group
I was looking into GWT. It seems nice, but our software have the must

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.