• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How to retrieve the script name inside Powershell?

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

Thanks!
 

My Computer

M

Marco Shaw [MVP]

#2
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 Computer

M

Martin Zugec

#3
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 Computer

Users Who Are Viewing This Thread (Users: 1, Guests: 0)