替换Windows PowerShell中的“pwd”

替换Windows PowerShell中的“pwd”,powershell,pwd,Powershell,Pwd,我有一个使用命令的Unix脚本 Current_Dir=`pwd` 在Windows Power shell脚本中,它的合适替代品是什么?使用$pwd.Path表达式 write-host $pwd.Path 只需使用“pwd”或“Get Location”(“pwd”只是“Get Location”的别名) 另外:您不需要在PS中使用引号,就像在unixshell中一样 Powershell有许多与Linux相同的命令。pwd是等效的命令。 在Powershell中键入pwd时,它是获取位

我有一个使用命令的Unix脚本

Current_Dir=`pwd`

在Windows Power shell脚本中,它的合适替代品是什么?

使用
$pwd.Path
表达式

write-host $pwd.Path
只需使用“pwd”或“Get Location”(“pwd”只是“Get Location”的别名)

另外:您不需要在PS中使用引号,就像在unixshell中一样

Powershell有许多与Linux相同的命令。pwd是等效的命令。 在Powershell中键入pwd时,它是获取位置的别名


如果您试图使用当前目录创建var,则这两项都是有效的:

$current_directory = (pwd).path
$current_directory = pwd
Powershell的开发团队包含几个Unix人员,因此其中有一些好东西,如
ls
pwd
cat