Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- param(
- [string]$configLocation,
- [switch]$bugger,
- [switch]$readmotd,
- [switch]$simulate,
- [switch]$resetdate
- )
- $terminate = $true # Variable for exiting
- $rootdir = $PSScriptRoot # Finds the root directory
- if ($readmotd) {$motd = Get-Content "$rootdir\bin\motd.txt"} # Reads the changelog/motd
- Do {
- # Reads the motd
- if ($readmotd) {Write-Host $motd}
- #Builds the Command
- $exp = "$rootdir\Start-YtdlManager.ps1"
- if ($configlocation -ne $null) { $exp += " -configlocation $configlocation" }
- if ($bugger) { $exp += " -bugger" }
- if ($simulate) { $exp += " -simulate" }
- if ($resetdate) { $exp += " -resetdate" }
- if ($bugger) {Write-Host "Expression is:" $exp }
- # Launches the Script
- Write-Host "Launching Randall's YouTube-DL Manager"
- Invoke-Expression $exp
- # System/Menu for Restarting the Process
- $prompt = 'Press R to restart, Q to quit, or D to reset the Download Date'
- $option = ''
- $validoptions = ('R','Q','D')
- while ($option -eq '') {
- $option = (Read-Host $prompt).ToUpper()
- if ($option -notin $validoptions) {
- Write-Host ' Invalid Selection'
- $option = ''
- pause
- }
- }
- switch ($option) {
- 'R' {$terminate = $false; break}
- 'Q' {$terminate = $true; break}
- 'D' {$terminate = $false; $resetdate = $true; break}
- }
- } Until ($terminate)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement