I use shortcuts to launch my scripts (mostly because -executionpolicy bypass is so convenient) and obviously PowerShell is aware of the name of this shortcut, since the title bar of the console includes it. But how does one get to this path from within the script? I can get the path of the actual ps1 file that is running, but I haven't found a way to get to the calling shortcut path.
Also, a little off topic, but is it possible to provide the path to the icon for a shortcut as a relative path? So that the icon can be provided in the folder structure, and the folder can go anywhere? Or is the icon path a dumb/literal path?
My goal is to provide my own icon files, in the folders provided, with shortcuts that reference those icons. If I could do a relative path I would be done. Failing that I can provide a shortcut and have my script trace back the calling shortcut and then update the icon with the current path. If the folder gets moved the icons are broken, until first use, when they are properly repathed again.