I’ve been banging my head against the wall on this one. So if anyone can help my I’d be very happy!
I want to add the path to my local modules via my $PROFILE. The command I want to use looks as this:
$env:PSModulePath += ‘;’+ (Join-Path -Path ${env:HOME} -ChildPath ‘Documents\WindowsPowerShell\Modules’)
What bugs me is that this command works fine when i run it from the command line, i.e. the “documents\WindowsPowerShell\Modules” location is added to the $env:PSModulePath.
but when I add the very same line to my $PROFILE it does not work. I get the error:
Join-Path : Cannot bind argument to parameter ‘Path’ because it is null.
At C:\Users\Joakim\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:3 char:44
- $env:PSModulePath += ‘;’+ (Join-Path -Path ${env:HOME} -ChildPath 'Do …
-
~~~~~~~~~~~- CategoryInfo : InvalidData: (
[Join-Path], ParameterBindingValidationException FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
- CategoryInfo : InvalidData: (
Is there something special about how the $PROFILE can or can not access environment variables? Or can any of you guys see what misstake I have made?