Ensure profile files can be created
This commit is contained in:
parent
00d349e162
commit
c71a8edcaf
1 changed files with 7 additions and 2 deletions
|
@ -47,13 +47,18 @@ class Context {
|
|||
}
|
||||
|
||||
$profileFiles | ForEach-Object {
|
||||
$dirName = Split-Path -Parent $_;
|
||||
$fileName = "C:\Users\Default\$_";
|
||||
$dirName = Split-Path -Parent $fileName;
|
||||
|
||||
if (-not (Test-Path -PathType Container $dirName)) {
|
||||
New-Item -ItemType Directory $dirName;
|
||||
}
|
||||
|
||||
Add-Content -Force "C:\Users\Default\$_" "`n$statement";
|
||||
if (Test-Path -PathType Leaf $fileName) {
|
||||
Add-Content -Force "$fileName" "`n$statement";
|
||||
} else {
|
||||
Set-Content -Force "$fileName" "$statement";
|
||||
}
|
||||
};
|
||||
|
||||
Pop-Location;
|
||||
|
|
Loading…
Reference in a new issue