#This script downloads and installs ffmpeg WAV to MP3 converter, it must be run with admin privledges
#This script downloads and installs 7-zip(used to install ffmpeg)
#The 7-zip downloaded and installed is for 64 bit computers in C:\Program Files\7-Zip
#The ffmpeg is stored in $Home\Programming\ffmpeg directory.
$Date = [System.datetime]::now.ToString("yyyy-MM-dd")
$Junk = "$Home\Junk$Date"
if(!$(Test-Path $Junk)) { $void = New-Item -ItemType directory -Path $Junk }
#If 7-zip is not installed (it is needed to extract the data .gz file)
if(!$(Test-Path "C:\Program Files\7-Zip")) {
write-host "Downloading 7-Zip"
$webclient = New-Object System.Net.WebClient
$url = "http://downloads.sourceforge.net/sevenzip/7z920-x64.msi"
$file = "$Junk\7z920-x64.msi"
$webclient.DownloadFile($url,$file)
write-host "Installing 7-Zip"
Start-Process -file "$Junk\7z920-x64.msi" `
-arg ' /qn INSTALLDIR="C:\Program Files\7-Zip" ' `
-passthru | wait-process
}
#Create a programming folder in our Home directory.
$pgmDirectory = "$Home" + "\programming"
if(!$(Test-Path $pgmDirectory)) { $void = New-Item -ItemType directory -Path $pgmDirectory }
#If the ffmpeg is not downloaded yet, download and extract it.
$ffmpeg = "$pgmDirectory\ffmpeg"
if(!$(Test-Path $ffmpeg)) {
write-host "Downloading ffmpeg"
$webclient = New-Object System.Net.WebClient
$url = "http://ffmpeg.zeranoe.com/builds/win64/shared/ffmpeg-20140424-git-443936d-win64-shared.7z"
$file = "$Junk\ffmpeg-20140424-git-443936d-win64-shared.7z"
$webclient.DownloadFile($url,$file)
write-host "Installing ffmpeg"
$void = & "C:\Program Files\7-Zip\7z.exe" "x" "$file" "-o$Junk"
$dir = $(Get-ChildItem -Directory -Path $junk | ?{$_.Name.ToUpper().Contains("FFMPEG")})[0]
$Location = $dir.FullName
if(!$(Test-Path $ffmpeg)) { $void = New-Item -ItemType directory -Path $ffmpeg }
Copy-Item "$Location\*" $ffmpeg -Recurse
}
Write-Host "ffmpeg install is completed"
Remove-Item $Junk -Force -Recurse
<#
#Run this commented out section to uninstall FFmpeg (All programs that used this assembly (including Powershell) must be closed before running this script).
#This uninstalled assummes that you have it installed in the same directories this script installed it to.
$unstlDirectory = "$Home" + "\programming" + "\ffmpeg"
Remove-Item $unstlDirectory -Force -Recurse
#>
No comments:
Post a Comment