我已经知道它做了什么:--它只是向后转一个目录或文件夹--。
但对我来说神秘的是那两个点。
cd.. #it has the same function as popd with the difference that it changes the
#current working directory
如果有人告诉我把这两个放在一起的哲学是什么,我会非常感激的。
发布于 2019-10-05 22:06:11
文件系统路径中的..
表示给定路径的父路径 path。
如果在..
之前没有显式路径,则隐含路径是当前工作目录,因此..
引用当前目录的父目录。
简而言之:带有cd
..
参数的更改到当前目录的父目录目录,即目录层次结构中高于一级的目录。
..
Shell-与 cd
**:**的特定使用
cmd.exe
(“命令提示符”)--似乎与内部的cd
命令(见Mofi对这个问题的注释)--考虑使用 .
字符隐式地启动E 248
cd
E 152
命令的e 253
argument.。
- Therefore, separating the `cd` _command_ from the `..` _argument_ with _a space character_, as usual, isn't _necessary_; that is, **instead of** **`cd ..`** **you can type** **`cd..`**, which is a shortcut that users of `cmd.exe` have grown accustomed to over the years.
.
字符,因此提交cd..
会调用E 278
cd
E 182
命令(E 283
Set-Location
E 187cmdlet的内置别名),因此提交cd..
会调用E 278cd
命令(E 283Set-Location
cmdlet),并带有参数E 288
..
--相反,它查找的命令实际上名为cd..
。
- **To accommodate** **`cmd.exe`** **users who are accustomed to the** **`cd..`** **shortcut, PowerShell comes with a** _**parameter-less function literally named**_ _**`cd..`**_, so that submitting `cd..` as a command in PowerShell effectively works the same as in `cmd.exe`.
- However, note that **only** **`cd..`** **works, not also specifying additional components**; that is, **something like** **`cd..\Foo`** **(which works in** **`cmd.exe`****) fails**.
- `Get-Command cd.. | Format-List` shows information about this function, which reveals that it simply calls `Set-Location ..`, which is PowerShell's equivalent of `cmd.exe`'s `cd ..`
发布于 2019-10-05 06:50:12
这两个点的意思是“目录中的一个上层”。
cd
指定更改目录,..
的意思是“上层”。所以,cd..
就是你在问题中所说的意思。
示例:,假设您位于文件夹C:\x\y中。如果键入cd..
,您将使用C:\x
https://stackoverflow.com/questions/58246025
复制相似问题