# Instala MorisBasic, MorisRar, MorisPhoto o MorisVideo en Windows sin el bloqueo de Edge ni de SmartScreen. # Descarga el instalador con PowerShell (no pasa por el navegador), comprueba su huella SHA-256 y lo instala # en silencio, solo para tu usuario (no pide administrador). Si la huella no coincide, no instala nada. # # Uso (en PowerShell, sin ser administrador): # irm https://juanmansoftware.pages.dev/instalar-windows.ps1 | iex (te pregunta cual) # $env:MORIS='photo'; irm https://juanmansoftware.pages.dev/instalar-windows.ps1 | iex (basic | rar | photo | video) # & ([scriptblock]::Create((irm https://juanmansoftware.pages.dev/instalar-windows.ps1))) video # Variable opcional: $env:MORIS_NO_OPEN=1 para no abrir el programa al terminar. # Huellas y codigo fuente: https://juanmansoftware.pages.dev/windows.html try { [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 } catch { } $MorisBase = 'https://juanmansoftware.pages.dev/descargas/' $MorisApps = @( @{ Key='basic'; Num='1'; Name='MorisB' + [char]225 + 'sic'; Dir='MorisBasic'; File='MorisBasic-1.0.0-Windows-Setup.exe'; Sha='bf04e0b6e66f8b5a982cbd65e1673039288ef7b6207532978e6304ed3417538b'; Size='110 MB' } @{ Key='rar'; Num='2'; Name='MorisRar'; Dir='MorisRar'; File='MorisRar-1.0.0-win-x64-regalo-setup.exe'; Sha='5228940cffd035bd38c52c4bf1f7ec44c12fcd2abac6433f76937ad3b18cec5a'; Size='106 MB' } @{ Key='rar-arm64'; Num=''; Name='MorisRar (ARM64, beta)'; Dir='MorisRar'; File='MorisRar-1.0.0-win-arm64-regalo-setup.exe'; Sha='070547523394ed04b3ffb7109e13b82d24b075e676f69f2bba971d74186dc6ad'; Size='98 MB' } @{ Key='photo'; Num='3'; Name='MorisPhoto'; Dir='MorisPhoto'; File='MorisPhoto-1.0.0-win-x64-regalo-setup.exe'; Sha='a0ce98407a3823d7e775b4e132ea8e66a12ebb5f1b18c8edc058d211c719cc5b'; Size='112 MB' } @{ Key='video'; Num='4'; Name='MorisVideo'; Dir='MorisVideo'; File='MorisVideo-1.0.0-win-x64-regalo-setup.exe'; Sha='d60d970f5f097d5b88f9799bc7b2cc8a86f2c4a179de1da45fac9afe823dc3bf'; Size='137 MB' } ) function Get-MorisFile { param([string]$Url, [string]$Dest, [string]$Label) $req = [System.Net.HttpWebRequest]::Create($Url) $req.UserAgent = 'MorisInstaller/1.0 (PowerShell)' $resp = $req.GetResponse() $total = $resp.ContentLength $in = $resp.GetResponseStream() $out = [System.IO.File]::Create($Dest) try { $buf = New-Object byte[] 1048576 $done = [long]0 $sw = [System.Diagnostics.Stopwatch]::StartNew() $last = [long]0 while (($n = $in.Read($buf, 0, $buf.Length)) -gt 0) { $out.Write($buf, 0, $n) $done += $n if (($sw.ElapsedMilliseconds - $last) -ge 400) { $last = $sw.ElapsedMilliseconds if ($total -gt 0) { $pct = [int][math]::Floor(100 * $done / $total) Write-Progress -Activity ('Descargando ' + $Label) -Status ('{0:N0} de {1:N0} MB' -f ($done / 1MB), ($total / 1MB)) -PercentComplete $pct } } } } finally { $out.Dispose(); $in.Dispose(); $resp.Close() Write-Progress -Activity ('Descargando ' + $Label) -Completed } } function Select-MorisApp { param([string]$Choice) $c = '' if ($Choice) { $c = $Choice.Trim().ToLower() } if (-not $c) { Write-Host '' Write-Host ' Que quieres instalar?' Write-Host ' 1) MorisBasic - oficina libre: documentos, hojas, presentaciones y PDF' Write-Host ' 2) MorisRar - archivos comprimidos (RAR, ZIP, 7z...)' Write-Host ' 3) MorisPhoto - edicion de fotos' Write-Host ' 4) MorisVideo - edicion de video' try { $c = (Read-Host ' Elige 1-4 [1]').Trim().ToLower() } catch { $c = '' } if (-not $c) { $c = '1' } } $aliases = @{ 'morisbasic' = 'basic'; 'morisbasico' = 'basic'; 'morisrar' = 'rar'; 'morisphoto' = 'photo'; 'morisvideo' = 'video'; 'rar-x64' = 'rar'; 'foto' = 'photo' } if ($aliases.ContainsKey($c)) { $c = $aliases[$c] } $arch = $env:PROCESSOR_ARCHITEW6432 if (-not $arch) { $arch = $env:PROCESSOR_ARCHITECTURE } if ($arch -eq 'x86') { throw 'Estos programas son solo para Windows de 64 bits.' } if ($c -eq 'rar' -and $arch -eq 'ARM64') { $c = 'rar-arm64' } $app = $MorisApps | Where-Object { $_.Key -eq $c -or ($_.Num -and $_.Num -eq $c) } | Select-Object -First 1 if (-not $app) { throw ('Opcion no valida: "' + $Choice + '". Usa basic, rar, photo o video.') } if ($app.Key -eq 'rar' -and $arch -eq 'ARM64') { $app = $MorisApps | Where-Object { $_.Key -eq 'rar-arm64' } | Select-Object -First 1 } if ($arch -eq 'ARM64' -and $app.Key -ne 'rar-arm64') { Write-Host ' Aviso: tu equipo es ARM64; este programa es de 64 bits Intel/AMD y funcionara por emulacion de Windows.' -ForegroundColor Yellow } return $app } function Install-Moris { param([string]$Choice) $ErrorActionPreference = 'Stop' $app = Select-MorisApp -Choice $Choice $url = $MorisBase + $app.File $tmp = Join-Path $env:TEMP ('moris-' + [guid]::NewGuid().ToString('N').Substring(0, 8)) New-Item -ItemType Directory -Path $tmp | Out-Null $file = Join-Path $tmp $app.File $keep = $false $installed = Join-Path $env:LOCALAPPDATA ('Programs\' + $app.Dir + '\' + $app.Dir + '.exe') try { Write-Host '' Write-Host ('-> Descargando ' + $app.Name + ' (' + $app.Size + ')...') Get-MorisFile -Url $url -Dest $file -Label $app.Name Write-Host '-> Comprobando la huella SHA-256...' $got = (Get-FileHash -LiteralPath $file -Algorithm SHA256).Hash.ToLower() if ($got -ne $app.Sha) { throw ('La huella no coincide (esperada ' + $app.Sha + ', obtenida ' + $got + '). No se instala nada.') } Write-Host ' Huella correcta.' try { Unblock-File -LiteralPath $file -ErrorAction SilentlyContinue } catch { } Write-Host ('-> Instalando ' + $app.Name + ' (puede tardar un minuto)...') $p = Start-Process -FilePath $file -ArgumentList '/S' -PassThru $null = $p.Handle if (-not $p.WaitForExit(600000)) { $keep = $true Write-Host ' El instalador sigue en marcha. Si ves su ventana, termina el asistente; despues puedes borrar:' -ForegroundColor Yellow Write-Host (' ' + $tmp) -ForegroundColor Yellow return } if (-not (Test-Path -LiteralPath $installed)) { Write-Host ' La instalacion silenciosa no termino bien. Abro el instalador normal...' -ForegroundColor Yellow Start-Process -FilePath $file -Wait } if (Test-Path -LiteralPath $installed) { Write-Host ('OK Listo: ' + $installed) -ForegroundColor Green if (-not $env:MORIS_NO_OPEN) { Start-Process -FilePath $installed } } else { Write-Host 'No he podido confirmar la instalacion. Si cancelaste el asistente, vuelve a ejecutar el comando.' -ForegroundColor Yellow } } finally { if (-not $keep) { Remove-Item -LiteralPath $tmp -Recurse -Force -ErrorAction SilentlyContinue } } } $MorisChoice = '' if ($env:MORIS) { $MorisChoice = $env:MORIS } elseif ($args.Count -gt 0) { $MorisChoice = [string]$args[0] } try { Install-Moris -Choice $MorisChoice } catch { Write-Host ('ERROR: ' + $_.Exception.Message) -ForegroundColor Red }