-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstall.ps1
More file actions
34 lines (28 loc) · 1.5 KB
/
Copy pathInstall.ps1
File metadata and controls
34 lines (28 loc) · 1.5 KB
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
34
# Install.ps1
# Creates the "JWST Wallpapers" icon on the desktop, pointing to the script in THIS folder.
# Works on any PC and from any path: just copy the folder and run this file.
#
# Usage: right-click Install.ps1 -> "Run with PowerShell"
# (or from a terminal) powershell -ExecutionPolicy Bypass -File .\Install.ps1
$ErrorActionPreference = 'Stop'
$here = if ($PSScriptRoot) { $PSScriptRoot } else { Split-Path -Parent $MyInvocation.MyCommand.Path }
$script = Join-Path $here 'Set-SpaceWallpapers.ps1'
if (-not (Test-Path $script)) {
Write-Host "ERROR: cannot find Set-SpaceWallpapers.ps1 in '$here'." -ForegroundColor Red
Write-Host "Make sure Install.ps1 is in the same folder as the script." -ForegroundColor Red
return
}
$desktop = [Environment]::GetFolderPath('Desktop')
$lnkPath = Join-Path $desktop 'JWST Wallpapers.lnk'
$psExe = Join-Path $env:SystemRoot 'System32\WindowsPowerShell\v1.0\powershell.exe'
$ws = New-Object -ComObject WScript.Shell
$sc = $ws.CreateShortcut($lnkPath)
$sc.TargetPath = $psExe
$sc.Arguments = "-ExecutionPolicy Bypass -WindowStyle Hidden -File `"$script`" -GUI"
$sc.WorkingDirectory = $here
$sc.IconLocation = "$env:SystemRoot\System32\imageres.dll,109"
$sc.Description = 'Opens the window to change the wallpapers (James Webb photos)'
$sc.Save()
Write-Host "Done! 'JWST Wallpapers' icon created on the desktop." -ForegroundColor Green
Write-Host "Working folder: $here"
Write-Host "Double-click the icon to choose which monitor to change."