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
Try the following
$path = $MyInvocation.MyCommand.Definition
This may not give you the actual path typed in but it will give you a valid path to the file.