还有什么路径除了相对路径和绝对路径
时间: 2023-12-13 09:05:34 浏览: 32
除了相对路径和绝对路径之外,还有以下两种路径:
1. 网络路径:用于访问其他计算机上的共享资源,以网络地址开头,如:\\192.168.1.2\shared\file.txt。
2. 环境变量路径:用于指定系统中定义的环境变量路径,如:%PATH%。它可以在任何地方使用,因为它是操作系统定义的变量。
相关问题
什么是相对路径和绝对路径
相对路径和绝对路径是指文件在计算机中的位置。相对路径是相对于当前文件所在的位置来描述文件的位置,而绝对路径则是文件在硬盘上真正存在的路径。相对路径使用“/”字符作为目录的分隔字符,而绝对路径可以使用“\”或“/”字符作为目录的分隔字符。相对路径只能在内部存取,而绝对路径可以从外部或内部存取。
举个例子,如果一个文件“1.htm”所在目录为“C:\Users\15063\Desktop\lqf”,而“1.txt”文件所在目录为“C:\Users\15063\Desktop”,那么“1.txt”相对于“1.htm”文件来说,是在其所在目录的上级目录里。而“1.txt”文件的绝对路径就是“C:\Users\15063\Desktop\1.txt”。
什么是绝对路径和相对路径
在计算机中,绝对路径和相对路径都是用来描述文件或目录在文件系统中的位置。
绝对路径是指从根目录开始一直到该文件或目录的完整路径。例如,Windows系统中的绝对路径可能长这样:`C:\Users\username\Documents\example.txt`。Linux系统中的绝对路径可能长这样:`/home/username/Documents/example.txt`。
相对路径是相对于当前工作目录的路径。例如,在Windows命令提示符中,如果当前工作目录是`C:\Users\username\Documents`,则相对路径`example.txt`表示`C:\Users\username\Documents\example.txt`。在Linux终端中,如果当前工作目录是`/home/username/Documents`,则相对路径`example.txt`表示`/home/username/Documents/example.txt`。
需要注意的是,相对路径不以根目录开始,而是以当前目录作为起点。在不同的操作系统和编程语言中,相对路径的表示方法可能有所不同,但基本原理都是相似的。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_lunwen.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)