diff --git a/scripts/Windows/Scripts/Context.ps1 b/scripts/Windows/Scripts/Context.ps1 index 2ecd02bb..32670ffa 100644 --- a/scripts/Windows/Scripts/Context.ps1 +++ b/scripts/Windows/Scripts/Context.ps1 @@ -46,7 +46,16 @@ class Context { $profileFiles = $profileFiles | ForEach-Object { Join-Path (Split-Path -Parent $_) "profile.d" "$category.ps1"; }; } - $profileFiles | ForEach-Object { Add-Content "C:\Users\Default\$_" "`n$statement"; }; + $profileFiles | ForEach-Object { + $dirName = Split-Path -Parent $_; + + if (-not (Test-Path -PathType Container $dirName)) { + New-Item -ItemType Directory $dirName; + } + + Add-Content -Force "C:\Users\Default\$_" "`n$statement"; + }; + Pop-Location; }