【发布时间】:2011-10-11 21:53:18
【问题描述】:
我希望这个小的 powershell one liner 能够回显 foo.txt 的完整路径,该目录是我的当前目录。
[System.IO.Path]::GetFullPath(".\foo.txt")
但事实并非如此。它打印...
C:\Documents and Settings\Administrator\foo.txt
我不在 $home 目录中。为什么会在那里解决?
【问题讨论】:
-
你应该在 powershell 中使用 Resolve-Path。
-
在某些系统上,它返回相对于 c:\Windows\system32。
标签: powershell