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.

8 comments:

  1. tableau software learningempowers users to transform raw data into clear, interactive visualizations for better decision-making.

    ReplyDelete
  2. EasyPayTax provides hassle-free GST filing, income tax returns, and compliance services, helping individuals and businesses stay compliant with accurate, timely, and expert support.GST registration in Hyderabad

    ReplyDelete
  3. EasyPayTax simplifies taxation by offering professional GST, income tax, and business compliance services, ensuring smooth filings, reduced errors, and complete peace of mind.tax compliance services in Hyderabad

    ReplyDelete
  4. EasyPayTax is a trusted tax service provider delivering efficient GST filing, income tax returns, and compliance solutions tailored for individuals, startups, and businesses.online CA services in Hyderabad

    ReplyDelete
  5. "Enhance your data visualization skills with comprehensive tableau software learning Master interactive dashboards, analytics, and reporting to make data-driven decisions effectively."

    ReplyDelete
  6. "Enhance your career with our comprehensive salesforce administrator training designed for beginners and professionals alike. Learn to manage Salesforce effectively, automate processes, and maximize CRM efficiency."

    ReplyDelete
  7. "Accelerate your career with tableau software learning mastering data visualization and analytics skills."

    ReplyDelete