I’m using a CSV file and Import-Csv to get a bunch of custom aliases and paths. I’m doing this so that I can do RUN and the path will be executed through Invoke-Item.
I can do this in the command shell window too to open the profile ps1 using: Invoke-Item $PROFILE – Which then starts the profile ps1 in notepad.
But I wanna use my run function. So I specify the alias “profile” in the CSV along with the path as “$PROFILE” which should then call “Invoke-Item $profile” – Except when I use it through the CSV, $profile remains a text and doesn’t get evaluated.
Is there a way to reevaluate a variable in a string?
You can evaluate it with the
Invoke-Expressioncmdlet (or its alias ‘iex’):