Folder Path of Powershell file In Powershell

前端 未结 4 1840
别跟我提以往
别跟我提以往 2021-02-05 02:38

No one seems to ask this simple question, so I will.

My PowerShell script file is located: C:/this-folder/that-folder/another-folder/powershell-file.ps1

4条回答
  •  闹比i
    闹比i (楼主)
    2021-02-05 03:08

    try this command in your script:

    Split-Path -parent $MyInvocation.MyCommand.Definition
    

提交回复
热议问题