What is the difference between an absolute and a relative path?

后端 未结 3 1000
小蘑菇
小蘑菇 2021-01-11 12:41

I am asking because I am working on a project for school. Yes this is homework. But, I\'m trying to understand a little bit more, though.

This is one example of wha

3条回答
  •  别那么骄傲
    2021-01-11 13:30

    Say you were giving directions to a spot. You have two methods you can describe getting to the location:

    • Relative to where you stand,
    • Relative to a landmark.

    Both get you to the same location, but the former doesn't always work ("take a left, then a right, go through two lights then take another right" wouldn't necessarily work from the next town over, but works from where you stand). That's essentially the difference.

    If you have C:\Windows\System32, that's an absolute path. If you have Windows\System32, it will only work so long as you're starting from C:\. If you start in C:\Program Files you would need a ..\ to get there correctly.

    However, no matter where you are on the hard drive, C:\Windows\System32\ is a definitive way to get to that folder.

提交回复
热议问题