我有一个Unix脚本,它使用以下命令
Current_Dir=`pwd`
在Windows Power shell脚本中,合适的替代方案是什么?
发布于 2014-02-18 07:16:03
如果您正在尝试使用当前目录创建var,则这两种方法都是有效的:
$current_directory = (pwd).path
$current_directory = pwd
Powershell的开发团队中有几个Unix的成员,所以也有一些好东西,比如ls
、pwd
和cat
发布于 2014-02-18 06:44:26
使用$pwd.Path
表达式
write-host $pwd.Path
发布于 2014-02-18 06:46:33
只需使用"pwd“或"Get-Location”("pwd“只是”Get-Location“的别名)。
ALso:在PS中不需要引号,就像在Unix shell中一样。
https://stackoverflow.com/questions/21846161
复制相似问题