1
0
Fork 0
dotfiles/run_once_windows_symlink_gitui.ps1

15 lines
667 B
PowerShell
Raw Normal View History

2022-04-12 13:56:22 +02:00
# Self-elevate the script if required
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
$CommandLine = "-NoExit -File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine
Exit
}
2022-04-13 21:42:31 +02:00
$config_folder = "$env:USERPROFILE\.config\gitui"
2022-04-12 13:56:22 +02:00
$symlink_folder = "$env:APPDATA\gitui"
if (Test-Path $symlink_folder) {
Remove-Item -Recurse $symlink_folder
}
New-Item -Path $symlink_folder -ItemType SymbolicLink -Value $config_folder
Start-Sleep -Seconds 5