1.    08 Nov 2009 #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.    08 Nov 2009 #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.    08 Nov 2009 #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


Similar Threads
Thread Forum
exchange powershell commands in C# errors! how to retrieve results?
Hello I'm trying to write a code that return results from exchange powershell commands I faced a problem when running this command "Get-mailbox...
PowerShell
Script to read information inside a pdf file
Hi ! I use the following VBA programmation to complete a pdf form (using SendKeys). Once the form is completed, the users can make modifications....
VB Script
Can PowerShell retrieve AD "Member Of' information?
I am learning PowerShell at the moment and when I worked in my help desk, we used to utilize showgrps and DS Query to pull in AD info out from the...
PowerShell
How can I resolve %WINDIR% inside a PowerShell script?
I want to run this command from within a PowerShell script: fsutil hardlink create %WINDIR%\system32\windowspowershell \v1.0\psh.exe...
PowerShell
Script to retrieve file versions
hi, I found this script on Scripting Guy. However I would like for the window to have the results of three file versions. Here's what I have now....
VB Script
a powershell window inside visual studio?
hi, seems to me it would be *very* convenient to be able to open up a powershell session inside visual studio. i've searched a bit but haven't...
PowerShell
when run powershell script as windows service ,powershell fail
On windows 2008 ,run powershell script by windows serivice application ,but this script always failed due to the following .Net runtime error ...
PowerShell

Our Sites
  • Ten Forums
  • Eight Forums
  • Seven Forums
  • PC Help Forum
  • Help Me Bake
  • Site Links
  • Contact Us
  • Privacy and Cookies
  • About Us
    Windows Vista Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

    Designer Media Ltd
    All times are GMT -5. The time now is 07:27.
    .