首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >什么是“cd.”在powershell里是什么意思?

什么是“cd.”在powershell里是什么意思?
EN

Stack Overflow用户
提问于 2019-10-05 06:45:44
回答 2查看 4.1K关注 0票数 2

我已经知道它做了什么:--它只是向后转一个目录或文件夹--

但对我来说神秘的是那两个点。

代码语言:javascript
运行
复制
cd.. #it has the same function as popd with the difference that it changes the 
     #current working directory

如果有人告诉我把这两个放在一起的哲学是什么,我会非常感激的。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-10-05 22:06:11

文件系统路径中的..表示给定路径的父路径 path

如果在..之前没有显式路径,则隐含路径是当前工作目录,因此..引用当前目录的父目录。

简而言之:带有cd .. 参数的更改到当前目录的父目录目录,即目录层次结构中高于一级的目录。

.. Shell- cd**:**的特定使用

cmd.exe (“命令提示符”)--似乎与内部的cd命令(见Mofi对这个问题的注释)--考虑使用 . 字符隐式地启动E 248 cd E 152命令的e 253 argument.。

代码语言:javascript
运行
复制
- 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.

  • PowerShell 允许在命令名中使用 . 字符,因此提交cd.. 会调用E 278 cd E 182命令(E 283 Set-Location E 187cmdlet的内置别名),因此提交cd..会调用E 278cd命令(E 283Set-Locationcmdlet),并带有参数E 288 .. --相反,它查找的命令实际上名为cd..

代码语言:javascript
运行
复制
- **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`.
代码语言:javascript
运行
复制
    - However, note that **only** **`cd..`** **works, not also specifying additional components**; that is, **something like** **`cd..\Foo`** **(which works in** **`cmd.exe`****) fails**.

代码语言:javascript
运行
复制
- `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 ..`

票数 3
EN

Stack Overflow用户

发布于 2019-10-05 06:50:12

这两个点的意思是“目录中的一个上层”。

cd指定更改目录,..的意思是“上层”。所以,cd..就是你在问题中所说的意思。

示例:,假设您位于文件夹C:\x\y中。如果键入cd..,您将使用C:\x

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58246025

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档