You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
1.1 KiB
26 lines
1.1 KiB
# Creates a desktop shortcut "DSH Memory" that starts the bridge hidden and idempotently. |
|
# Run once: powershell -NoProfile -ExecutionPolicy Bypass -File V:\Site\dsh-memory\scripts\create-desktop-shortcut.ps1 |
|
$ErrorActionPreference = 'Stop' |
|
$scriptsDir = $PSScriptRoot |
|
$root = Split-Path -Parent $scriptsDir |
|
$vbs = Join-Path $scriptsDir 'launch-dsh-memory.vbs' |
|
if (-not (Test-Path $vbs)) { throw "launch-dsh-memory.vbs not found: $vbs" } |
|
|
|
$desktop = [Environment]::GetFolderPath('Desktop') |
|
$lnk = Join-Path $desktop 'DSH Memory.lnk' |
|
|
|
$node = Get-Command node -ErrorAction SilentlyContinue |
|
$iconPath = if ($node) { $node.Source } else { "$env:SystemRoot\System32\shell32.dll" } |
|
|
|
$ws = New-Object -ComObject WScript.Shell |
|
$s = $ws.CreateShortcut($lnk) |
|
$s.TargetPath = 'wscript.exe' |
|
$s.Arguments = '"' + $vbs + '"' |
|
$s.WorkingDirectory = $root |
|
$s.IconLocation = "$iconPath,0" |
|
$s.Description = 'Start DSH Memory bridge (silent, no duplicates)' |
|
$s.WindowStyle = 1 |
|
$s.Save() |
|
|
|
Write-Host "Shortcut created: $lnk" |
|
Write-Host "Double-click it to start the bridge. If the bridge is already running, nothing happens."
|
|
|