param( $param1, $param2 )
# 检查并以管理员身份运行PS并带上参数
$currentWi = [Security.Principal.WindowsIdentity]::GetCurrent()
$currentWp = [Security.Principal.WindowsPrincipal]$currentWi
if( -not $currentWp.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{
$boundPara = ($MyInvocation.BoundParameters.Keys | foreach{'-{0} {1}' -f $_ ,$MyInvocation.BoundParameters[$_]} ) -join ' '
$currentFile = $MyInvocation.MyCommand.Definition
$fullPara = $boundPara + ' ' + $args -join ' '
Start-Process "$psHome\powershell.exe" -ArgumentList "$currentFile $fullPara" -verb runas
return
}
#————————————————————————————————————————————————————————————————————
# 放入需要运行的脚步
New-Item -ItemType SymbolicLink -Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp" -Name "DesktopMgr" -Value "C:\Program Files (x86)\Tencent\DeskGo\3.0.1411.127\DesktopMgr.exe"
New-Item -ItemType SymbolicLink -Path "C:\Users\lexin\Desktop" -Name "腾讯桌面整理" -Value "C:\Program Files (x86)\Tencent\DeskGo\3.0.1411.127\DesktopMgr.exe"
#———————————————————————————————————————————————————————————————————————
Write-Host '运行成功'
Read-Host