【发布时间】:2015-07-31 20:48:11
【问题描述】:
我正在编写一个脚本,其中第一个参数是文件名。但是,每当我尝试在需要文件的内容中使用该字符串时,都会收到有关找不到文件的错误消息。如何获取 powershell 提示符所在的当前目录?出于某种原因,它不断返回我的用户配置文件目录:
C:\Users\user1> [System.IO.Directory]::GetCurrentDirectory()
C:\Users\user1
C:\Users\user1> cd\
C:\> cd temp
C:\temp> [System.IO.Directory]::GetCurrentDirectory()
C:\Users\user1
【问题讨论】:
标签: powershell