windows 关于目录中的单点和双点

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3479744/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 15:02:02  来源:igfitidea点击:

Regarding the Single and the Double Dot within Directories

windowslinuxunix

提问by Sadique

Whenever we use the command:

每当我们使用命令时:

dir --> in Windows

and

dir -a --> in Unix

We see 2 kinds of dots:

我们看到两种点:

.
..

Appear in the directories. Now in APUE by Stephens Rago, it says these are filenames and some books say these are directories.

出现在目录中。现在在 Stephens Rago 的 APUE 中,它说这些是文件名,有些书说这些是目录。

What are these Dots about anyway? Please provide an answer w.r.t. Windows as well as Unix if possible.

这些点到底是关于什么的?如果可能,请在 Windows 和 Unix 上提供答案。

回答by Thomas Clayson

its the same for both platforms (and web based programming)

两个平台(和基于 Web 的编程)都相同

. represents the directory you are in and .. represents the parent directory.

. 代表您所在的目录,.. 代表父目录。

in HTML if you have a file eg: http://example.com/blog/index.htmland you want to link to the image http://example.com/images/image.jpgyou would put it in as such:

在 HTML 中,如果您有一个文件,例如:http: //example.com/blog/index.html并且您想链接到图像http://example.com/images/image.jpg,您可以将其放入:

<img src="../images/image.jpg" />

As that tells the script to look in the PARENT directory and then images/image.jpg.

因为这告诉脚本查看 PARENT 目录,然后查看 images/image.jpg。