Make WinSCP the default ftp program
This commit is contained in:
parent
6e6a8ebd6a
commit
339ea4f9b7
2 changed files with 33 additions and 0 deletions
32
scripts/Windows/Config/WinSCP/Install.ps1
Normal file
32
scripts/Windows/Config/WinSCP/Install.ps1
Normal file
|
@ -0,0 +1,32 @@
|
|||
#!/bin/pwsh
|
||||
param($context)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
|
||||
[Context] $context = $context;
|
||||
$tempDir = $context.GetTempDirectory();
|
||||
|
||||
Push-Location $tempDir;
|
||||
$configFile = "$tempDir/DefaultAssociations.xml";
|
||||
|
||||
Write-Information "Making WinSCP the default FTP program";
|
||||
DISM /Online "/Export-DefaultAppAssociations:$configFile";
|
||||
|
||||
[xml]$defaultAssociations = [xml]::new();
|
||||
$defaultAssociations.PreserveWhitespace = $true;
|
||||
$reader = [System.Xml.XmlReader]::Create("$configFile", $readerSettings);
|
||||
$defaultAssociations.Load($reader);
|
||||
$reader.Dispose();
|
||||
|
||||
foreach ($association in $defaultAssociations.SelectNodes("/DefaultAssociations/Association")) {
|
||||
if ($association.Identifier -eq "ftp") {
|
||||
$association.ProgId = "WinSCP.Url";
|
||||
$association.ApplicationName = "WinSCP: SFTP, FTP, WebDAV, S3 and SCP client";
|
||||
}
|
||||
}
|
||||
|
||||
$defaultAssociations.Save($configFile);
|
||||
DISM /Online "/Import-DefaultAppAssociations:$configFile";
|
||||
|
||||
Pop-Location;
|
||||
Remove-Item -Recurse $tempDir;
|
|
@ -5,3 +5,4 @@ param($context);
|
|||
[Context] $context = $context;
|
||||
|
||||
choco install -y winscp;
|
||||
. "$PSScriptRoot/../../Config/WinSCP/Install.ps1" $context;
|
||||
|
|
Loading…
Reference in a new issue