How do you set PowerShell's default directory?

前端 未结 13 1746
生来不讨喜
生来不讨喜 2021-01-30 01:37

Is there a way to change PowerShell\'s default location?

How do you set PowerShell\'s default working directory?

13条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-30 02:06

    This solution sets current working folder to location where script is located. Be sure to place at beginning of your script, or at least before you try to use command relying on location path.

    Set-Location (Split-Path $MyInvocation.MyCommand.Path)
    

提交回复
热议问题