-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRestore-WTProfile.ps1
More file actions
33 lines (31 loc) · 837 Bytes
/
Restore-WTProfile.ps1
File metadata and controls
33 lines (31 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function Restore-WTProfile
{
<#
.Synopsis
Restores a Windows Terminal Profile
.Description
Restores a Windows Terminal Profile backup.
.Example
Restore-WTProfile -SourcePath .\WindowsTerminal.2020-05-17.backup.json
.Link
Backup-WTProfile
#>
param(
[Parameter(Mandatory,ValueFromPipelineByPropertyName)]
[ValidatePattern('\.json$')]
[Alias('FullName')]
[string]
$SourcePath
)
process {
$destPath =
if (-not $script:WTProfilePath) {
Get-WTProfile -Setting | Select-Object -ExpandProperty Path
} else {
$script:WTProfilePath.Fullname
}
if ((Test-Path $SourcePath) -and $destPath) {
Copy-Item -Path $SourcePath -Destination $destPath
}
}
}