🔨 refactor: 创建 dir 符号链接;并编写 ps 脚本用于获取 windows 管理员权限

https://github.com/siyuan-note/siyuan/issues/12399
This commit is contained in:
frostime 2024-09-06 19:50:50 +08:00
parent da4c4ced8f
commit e345e18613
7 changed files with 327 additions and 355 deletions

24
scripts/elevate.ps1 Normal file
View file

@ -0,0 +1,24 @@
# Copyright (c) 2024 by frostime. All Rights Reserved.
# @Author : frostime
# @Date : 2024-09-06 19:15:53
# @FilePath : /scripts/elevate.ps1
# @LastEditTime : 2024-09-06 19:39:13
# @Description : Force to elevate the script to admin privilege.
param (
[string]$scriptPath
)
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
$projectDir = Split-Path -Parent $scriptDir
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
$args = "-NoProfile -ExecutionPolicy Bypass -File `"" + $MyInvocation.MyCommand.Path + "`" -scriptPath `"" + $scriptPath + "`""
Start-Process powershell.exe -Verb RunAs -ArgumentList $args -WorkingDirectory $projectDir
exit
}
Set-Location -Path $projectDir
& node $scriptPath
pause