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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:33:23+00:00 2026-06-15T14:33:23+00:00

I have definitely done something like this before, but something is not working right

  • 0

I have definitely done something like this before, but something is not working right and I’m not 100% sure what it is.

I have an executable executable.exe that takes a file, does some magic and outputs a second file somewhere else. So when I run this executable via CMD, all I need to do is pass "path1" and "path2". I put the paths in quotations because they may have spaces.

Anyway, so what I’m doing in my c# application is something like:

public void methodToRunExecutable()
{
var exePath = "\""+ "C:\\SomePathToAnExecutable" + "\"";
var firstFilePath = "C:\\PathToFirstFile\\NameOfFile.txt"
var secondFilePath= "C:\\PathToSecondFile\\NameOfFile.txt"

Process.Start(exePath, "\""firstFilePath + "\" \"" + secondFilePath+"\"")
}

However, I notice when I’m debugging is that the "\"" is actually showing up as \", like the backslash isn’t escaping the quotation mark.

To be clear, when I run the CMD exe all I have to do is:

"C:\\PathToFirstFile\\NameOfFile.txt" "C:\\PathToSecondFile\\NameOfFile.txt"

and it works great. Any Ideas on what I’m doing wrong? Is it because the " is not being escaped?

  • 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-15T14:33:25+00:00Added an answer on June 15, 2026 at 2:33 pm

    Escaping is ugly and error prone. Use @ and you won’t need to escape:

    var firstFilePath = @"C:\PathToFirstFile\NameOfFile.txt"
    

    It might also be easier to use Process this way:

    using (Process process = new Process())
    {
        process.StartInfo.FileName = exePath;
        process.StartInfo.Arguments = ""; // args here
        process.Start();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Some existing web services I consume have methods that look something like this: List<Employee>
I'm definitely missing something. I have an XML file that stores HTML snippets, as
This situation probably is not entirely uncommon to some of you: you have some
This is my first time using Stack Overflow, so if I've done something wrong
I'm sure this question has been asked but it's hard to just google specifically
I am definitely missing something very obvious but can anyone explain why there is
I have data that looks like this {super-row-key1 [{ts1 {version-ts1 value, version-ts2 value}} {ts2
I have all the dependancies installed (or I think I do). I definitely have
I have the following code which definitely returns a proper data result if I
I have file locale/es/LC_MESSAGES/django.mo (and .po), ran makemessages and compilemessages. Definitely all messages are

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.