Windows Vista Forums

How to retrieve the script name inside Powershell?
  1. #1


    Ben Guest

    How to retrieve the script name inside Powershell?


    $args contains the passing arguements, but no script name. How to get the
    script name inside itself in Powershell?



    Thanks!

      My System SpecsSystem Spec

  2. #2


    Marco Shaw [MVP] Guest

    Re: How to retrieve the script name inside Powershell?

    Inside the script, try:
    $MyInvocation.InvocationName

    "Ben" <Ben@newsgroup> wrote in message
    news:2DF1594D-CDF6-4A43-A2A5-B52B116CA6BA@newsgroup

    >
    > $args contains the passing arguements, but no script name. How to get the
    > script name inside itself in Powershell?
    >
    > Thanks!

      My System SpecsSystem Spec

  3. #3


    Martin Zugec Guest

    Re: How to retrieve the script name inside Powershell?

    Hi Ben,

    have a look at $MyInvocation variable (ScriptName).

    Martin

    "Ben" <Ben@newsgroup> wrote in message
    news:2DF1594D-CDF6-4A43-A2A5-B52B116CA6BA@newsgroup

    >
    > $args contains the passing arguements, but no script name. How to get the
    > script name inside itself in Powershell?
    >
    > Thanks!

      My System SpecsSystem Spec

How to retrieve the script name inside Powershell? problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Script to read information inside a pdf file Alex St-Pierre VB Script 1 07 Oct 2009
Can PowerShell retrieve AD "Member Of' information? briangw PowerShell 0 06 May 2009
How can I resolve %WINDIR% inside a PowerShell script? ssg31415926 PowerShell 3 04 Sep 2008
Script to retrieve file versions tke402 VB Script 1 30 Jul 2008
a powershell window inside visual studio? tbh PowerShell 2 03 Jul 2008