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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:19:18+00:00 2026-06-03T18:19:18+00:00

I have a path that is named defaultPath I want to add it into

  • 0

I have a path that is named defaultPath I want to add it into this verbatim string literal but can quite get the quotes around it.

    @"""C:\Mavro\MavBridge\Server\MavBridgeService.exe"" /service /data ""..\Data"""

I was trying to add +defaultPath to replace Data. So lets say I have a folder name Data.Apple I want the output to be

   "C:\Mavro\MavBridge\Server\MavBridgeService.exe" /service /data "..\Data.Apple"

But when I have been doing it for the past half hour I have been getting

   "C:\Mavro\MavBridge\Server\MavBridgeService.exe" /service /data "..\"Data.Apple

or

   "C:\Mavro\MavBridge\Server\MavBridgeService.exe" /service /data "..\" + defaultPath
  • 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-03T18:19:21+00:00Added an answer on June 3, 2026 at 6:19 pm

    Do it like this (preferred):

    string.Format(@"""C:\Mavro\MavBridge\Server\MavBridgeService.exe"" /service /data ""..\{0}""", defaultPath);
    

    Or like this:

    @"""C:\Mavro\MavBridge\Server\MavBridgeService.exe"" /service /data ""..\" + defaultPath + "\"";
    

    The first one uses string.Format, which basically replaces the {0} in the first parameter with the value in the second parameter and returns the result.

    The second one uses classical string concatenation and what I did there was to remove the double quotes after the last backslash (""..\ instead of ""..\""), because you didn’t want the quotes after the backslash. You wanted the quotes after defaultPath. And that’s what this code does: It appends defaultPath (" + defaultPath) and appends the closing quote afterwards (+ "\"").

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

Sidebar

Related Questions

I have a class named xmlReader that have parse(String path) and parseXml(Document doc) methods.
I have a string that represents a file path, such as /home/user/dir1/dir2/dir3/name.ext. Now I'd
For mistake I have added a path that I don't want to use. I
I have a path + filename that contains [] several times. What i want
I have for example .pdf file (path to that file). How to open this
I have a directory that is named admin. There is no physical path to
I have a Jar file named OuterJar.jar that contains another jar named InnerJar.jar this
I have this problem where all URLs like context/path/file/anything/that/follows becomes context/path/file.php/anything/that/follows or context/path/file.xml/anything/that/follows .
I have a feeling that the path to the assets file is wrong but
Let's imagine that I have list of files at host1 find /path/to -name *.jpg

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.