Wednesday, September 4, 2013

powershell script relative path

Here is the sample code to get the relative path of the powershell script which will help to make consistency when you run script files in multiple environments.

function scriptDirectory()
   $path = ""
   $path = [IO.Path]::GetFullPath((join-path $MyInvocation.ScriptName ".\.."))
   return $path

The above function will return the script file path as a string value.

1 comment:

  1. Its a wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way.Thank you so much

    Personal Installment Loans
    Payday Cash Advance loan
    Title Car loan
    Cash Advance Loan