summaryrefslogtreecommitdiff
path: root/scripts/make_lnk.ps1
blob: 2939cf3b7b92734625957bd35dba8d6277d7552c (plain)
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
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$originalLocation = Get-Location
Set-Location $scriptDir

$deployPs1 = Join-Path $scriptDir "dev\deploy.ps1"
$devDeployPs1 = Join-Path $scriptDir "dev\dev_deploy.ps1"
$parentDir = Split-Path $scriptDir -Parent

if (Test-Path $deployPs1) {
    $linkPath = Join-Path $parentDir "deploy.lnk"
    if (Test-Path $linkPath) { Remove-Item $linkPath -Force }
    $WshShell = New-Object -ComObject WScript.Shell
    $shortcut = $WshShell.CreateShortcut($linkPath)
    $shortcut.TargetPath = $deployPs1
    $shortcut.Save()
}

if (Test-Path $devDeployPs1) {
    $linkPath = Join-Path $parentDir "dev.lnk"
    if (Test-Path $linkPath) { Remove-Item $linkPath -Force }
    $WshShell = New-Object -ComObject WScript.Shell
    $shortcut = $WshShell.CreateShortcut($linkPath)
    $shortcut.TargetPath = $devDeployPs1
    $shortcut.Save()
}

Set-Location $originalLocation