I want to implement some alias-like command that could allow me to navigate through a long directory path by typing less.
In this answer I learned that it's not possible to create aliases for commands like "cd c:\some\dir
", but it's possible to create a function, save it into a script and then run it.
So I created a script, saved it in directory C:\ps_scripts, made sure this directory is listed in PATH, then opened PS from C:\ps_scripts and tried to issue command .\script.ps1 and nothing happened - no error, no output, no navigation to the desired directory path. script.ps1 contains the following code:
function fp { set-location "C:\Users\user\puppet\modules\fp\files\configs" }
Then I searched for solution here and tried to run the script by appending powershell -noexit "&
as advised in the accepted answer, but got error term '$' is not recognized
.
And my execution policy is set to RemoteSigned.
What could be the issue?