Read out the current directory of the * .ps1 file

Hello everybody.
I have a PowerShell file x.ps1. This is called up by a link.
With (Get-Location) .Path I read my current directory. This is output differently when I run the code directly in the ps1 file than when I call the ps1 file through the link.

Give it another command so I can get my current directory. That of the ps1 file. No matter how I call it. Or is there a way in the ps1 file to determine by code whether this file is executed itself or is started by a shortcut?

here is how i retrieve the location that the running ps1 is called from. I use this quite heavily

[pre]

$path = Split-Path -parent $MyInvocation.MyCommand.Definition

[/pre]

Try the built-in variable $PSScriptRoot

that should get you the directory of the .ps1 file.
@David Schmidtberger;@mraol_posh,
Hello, both solutions works. Many thanks for your help.