mirror of
https://github.com/opencv/opencv.git
synced 2025-06-11 20:09:23 +08:00
Merge pull request #14229 from alalek:ffmpeg_downloader_elevated_run
This commit is contained in:
commit
ba6c2df15d
16
3rdparty/ffmpeg/ffmpeg-download.ps1.in
vendored
16
3rdparty/ffmpeg/ffmpeg-download.ps1.in
vendored
@ -12,6 +12,22 @@ Write-Output ("=" * 120)
|
||||
Write-Output ""
|
||||
|
||||
if(![System.IO.File]::Exists($output)) {
|
||||
try {
|
||||
[io.file]::OpenWrite($output).close()
|
||||
} catch {
|
||||
Write-Warning "Unable to write: $output"
|
||||
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
|
||||
Write-Warning "Launching with 'Administrator' elevated privileges..."
|
||||
Pause
|
||||
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
|
||||
exit
|
||||
} else {
|
||||
Write-Output "FATAL: Unable to write with elevated privileges: $output"
|
||||
Pause
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Write-Output ("Downloading: " + $output)
|
||||
Import-Module BitsTransfer
|
||||
|
Loading…
Reference in New Issue
Block a user