Skip to content

Instantly share code, notes, and snippets.

@chrisfcarroll
Created July 8, 2017 10:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisfcarroll/a0acb594caf41ae7a28b605475dcf30e to your computer and use it in GitHub Desktop.
Save chrisfcarroll/a0acb594caf41ae7a28b605475dcf30e to your computer and use it in GitHub Desktop.
Youtube Downloader Prompting Wrapper : wraps youtube-dl.exe for a start-menu icon that prompts for the url to download.
param( [Parameter(Mandatory=$true)][string]$UrlToDownload )
$downloadDirectory="C:\Users\Services\Downloads"
cd $downloadDirectory
write-host ""
write-host ""
write-host "Downloading $urlToDownload to $downloadDirectory ..."
write-host ""
write-host ""
$Error.Clear()
youtube-dl.exe $urlToDownload
if($Error){
start youtube-dl -verb Runas -ArgumentList "-U"
Write-Warning "======================================================="
Write-Warning "The youtube downloader has to update first."
Write-Warning "Please try again after the update has run."
Write-Warning "======================================================="
pause
} else {
write-host ""
write-host ""
ls | where {$_.LastWriteTime -gt [DateTime]::Today}
write-host ""
start-process $downloadDirectory
}
@chrisfcarroll
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment