-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.ps1
43 lines (35 loc) · 1.13 KB
/
install.ps1
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
35
36
37
38
39
40
41
42
43
#!/usr/bin/env powershell
# Installation script (PowerShell, Windows OS)
#
# it creates symbolic links in the HOME directory pointing to local files
#
Write-Host "Crete links"
Write-Host "Environment variable 'HOME': " $env:HOME
$scriptpath = $MyInvocation.MyCommand.Path
$dir = Split-Path $scriptpath
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
$arguments = "& '" + $myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
Break
}
Write-host "Source directory: $dir"
Function Make-DirLink {
Param (
[string]$source,
[string]$target
)
Process {
if (Test-Path $target -PathType Container)
{
Write-Host "`nWARNING: Directory/Link already exists: " $target
Write-Host "Exit without creating link!`n"
} else
{
New-Item -ItemType Junction -Value $source -Path $target
}
}
}
Make-DirLink (Join-path $dir pcbenv) (Join-path $env:HOME "pcbenv")
Write-Host ""
pause