Windows 相当于 UNIX pwd

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/921741/
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-09 06:25:43  来源:igfitidea点击:

Windows equivalent to UNIX pwd

windowscmdpwd

提问by Joshua

How do I find the local path on windows in a command prompt?

如何在命令提示符下找到 Windows 上的本地路径?

回答by Petar Kabashki

This prints it in the console:

这将在控制台中打印出来:

echo %cd%

or paste this command in CMD, then you'll have pwd:

或将此命令粘贴到 CMD 中,然后您将拥有pwd

(echo @echo off
echo echo ^%cd^%) > C:\WINDOWS\pwd.bat

回答by Daniel A. White

It is cdfor "current directory".

cd用于“当前目录”。

回答by Fernando

Open notepad as administrator and write:

以管理员身份打开记事本并写入:

@echo %cd%

Save it in c:\windows\system32\ with the name "pwd.cmd" (be careful not to save pwd.cmd.txt)

将其保存在 c:\windows\system32\ 中,名称为“pwd.cmd”(注意不要保存 pwd.cmd.txt)

Then you have the pwd command.

然后你有 pwd 命令。

回答by user4350567

cd ,

it will give the current directory

它将给出当前目录

D:\Folder\subFolder>cd ,
D:\Folder\subFolder

回答by Roy Tinker

cdwithout any parameters is equivalent to pwdon Unix/Linux.

cd不带任何参数相当于pwd在 Unix/Linux 上。

From the console output of typing cd /?:

从输入的控制台输出cd /?

Displays the name of or changes the current directory.

[...]

Type CD without parameters to display the current drive and directory.

回答by sean e

hmm - pwd works for me on Vista...

嗯 - pwd 在 Vista 上对我有用...

Final EDIT: it works for me on Vista because WinAvr installed pwd.exe and added \Program Files\WinAvr\Utils\bin to my path.

最终编辑:它在 Vista 上对我有用,因为 WinAvr 安装了 pwd.exe 并将 \Program Files\WinAvr\Utils\bin 添加到我的路径中。

回答by phuclv

In PowerShell pwdis an alias to Get-Locationso you can simply run pwdin it like in bash

在 PowerShell 中pwd是一个别名,Get-Location因此您可以pwd像在 bash 中一样简单地在其中运行

It can also be called from cmd like this powershell -Command pwdalthough cdor echo %cd%in cmd would work just fine

它也可以从CMD叫这样powershell -Command pwd虽然cd还是echo %cd%在cmd中会工作得很好

回答by phuclv

C:\Documents and Settings\Scripter>echo %cd%
C:\Documents and Settings\Scripter

C:\Documents and Settings\Scripter>

for Unix use pwdcommand

对于 Unix 使用pwd命令

Current working directory

当前工作目录

回答by phuclv

Use the below command

使用下面的命令

dir | find "Directory"

回答by Mastereve

You can simply put "." the dot sign. I've had a cmd application that was requiring the path and I was already in the needed directory and I used the dot symbol.

您可以简单地输入“。” 点符号。我有一个需要路径的 cmd 应用程序,我已经在所需的目录中,我使用了点符号。

Hope it helps.

希望能帮助到你。