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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:09:35+00:00 2026-05-28T04:09:35+00:00

So I was successfully able to run a command line application with various arguments

  • 0

So I was successfully able to run a command line application with various arguments from within my project using the following code:

String f = fileName;
Process process = new System.Diagnostics.Process();
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.FileName = "C:\\projects\\something\\MediaInfo.exe";
process.StartInfo.Arguments = " \"--Inform=Video;%Duration%|%Width%|%Height%;\" \"" + f + "\"";
process.Start();
StreamReader output = process.StandardOutput;
process.WaitForExit();
MessageBox.Show(output.ReadToEnd());

Now, rather than the absolute path I’ve specified for MediaInfo.exe I’d like to specify a relative path so that when I send my application to someone they won’t need to muck about with placing it in the correct place.

In Visual Studio, I select my project and clicked add existing. I added my files. Then selected “Always Copy.” I’ve tried various items for the “Build Action.” I have a feeling “None” is the correct option.

In any case, my goal is to have process.StartInfo.FileName be a relative path. I don’t know how to do this right. Any ideas?

  • 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-28T04:09:35+00:00Added an answer on May 28, 2026 at 4:09 am

    The root directory of your application can be obtained by…

    string appRoot = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
    

    This statement requires System.IO and System.Diagnostics in order to compile.

    You can append to this value to reach a subdirectory, for example “data”, in your application root by…

    string dataPath = Path.Combine(appRoot, "data");
    

    The application needs to be running in full trust for these to work…

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

Sidebar

Related Questions

I'm able to run the following curl command (at the command line) successfully: curl
My question concerns using aidl.exe (on a Windows system) from the command line. This
I've following problem, which I've not been able to do successfully. Your help will
So I've installed msysgit, and run git successfuly from the bash shell. From within
I am using open source C++ library DCMTK from http://dicom.offis.de/dcmtk.php.en . I have successfully
I'm working on an app and I've been able to successfully debug it using
I have some code I run against other code. Let say command x runs
What are the steps needed to successfully be able to remotely debug a stored
I've created my own WCF service and I've successfully been able to talk to
I am able to successfully call a function with ctypes in Python. I now

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.