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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:22:51+00:00 2026-06-15T19:22:51+00:00

I need to get an absolute path from a relative path, but using a

  • 0

I need to get an absolute path from a relative path, but using a folder other than where the assembly is executing from to resolve "." and "..". Path.GetFullPath does not provide such an overload.

For example, say I have the following path:

..\MyOtherFolder\foo.bar

And the folder the assembly is executing from is:

c:\users\me\desktop\source\myproj\bin\debug\

but it could, in practice, be located anywhere.

I want to specify the “current” folder as c:\test so the ".." resolves to "c:\".

Does anyone know if this is built into the .NET framework anywhere? If not, I plan on making a Utility method, but I thought I’d check first (especially since there’s no static extension methods…).

EDIT:

Path.Combine will not work. All this method essentially does is concatenate the two strings.

  • 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-15T19:22:52+00:00Added an answer on June 15, 2026 at 7:22 pm

    If you’re currently in c:\test and you want to get c:\MyOtherFolder\foo.bar without knowing that you’re in c:\test you want to do;

     Environment.CurrentDirectory = @"..\MyOtherFolder"; //navigation accepts relative path
     string fullPath = Directory.GetCurrentDirectory(); // returns full path
    

    After that you may want to set the current directory back to your previous location.

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

Sidebar

Related Questions

I need to get Absolute path to Folder in Assets. Some like this for
I need to get a file name from file's absolute path (I am aware
I'm trying to write a relative path from a file but the only relative
I need to get an absolute file path into the native AIR browser. I've
I'm trying to load images from a relative folder /media/one.jpg but it never loads,
I have a web app and I need to get absolute path of a
I need to get the absolute path of the root in an asp.net mvc
I wrote a WCF service with a function that using absolute path to get
I need to get the contents from this URL http://google.fr/ok in a NSString can
My login redirect is being built with an absolute url but I need to

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.