Skip to content
Discussion options

You must be logged in to vote

New-Item $Profile -Type File will fail on systems where PowerShell hasn't already been installed because the folder powershell that will contain the profile script, doesn't yet exist & is why you are getting

System.IO.DirectoryNotFoundException: Could not find a part of the path '/home/RokeJulianLockhart/.config/powershell/Microsoft.PowerShell_profile.ps1

You can confirm this with
Test-Path $PROFILE - FALSE - this tests the full path to the profile
Test-Path $PROFILE\..\ - FALSE - this tests the parent directory, which hasn't been created
test-path $PROFILE\..\.. - TRUE - this tests the grandparent directory, which should exist.

If you don't feel comfortable with recommending New-Item $Pr…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@beedell-roke
Comment options

Answer selected by beedell-roke
Comment options

You must be logged in to vote
1 reply
@beedell-roke
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants