如何获取提示的当前目录

Thr*_*aka 5 powershell

我正在编写一个脚本,其中第一个参数是文件名.但每当我尝试在带文件的东西中使用该字符串时,我都会收到有关未找到文件的错误.如何获取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
Run Code Online (Sandbox Code Playgroud)

Mar*_*ndl 9

pwd 是您搜索的cmdlet;)

这是别名Get-Location.