Note: PowerShell 1.0 I\'d like to get the current executing PowerShell file name. That is, if I start my session like this:
powershell.exe .\\myfile.ps
If you only want the filename (not the full path) use this:
$ScriptName = $MyInvocation.MyCommand.Name