diff --git a/Install.ps1 b/Install.ps1 new file mode 100644 index 0000000..5582bd9 --- /dev/null +++ b/Install.ps1 @@ -0,0 +1,29 @@ +param([string]$InstallDirectory) + +$fileList = echo EPPlus.dll ImportExcel.psd1 ImportExcel.psm1 + + +if ('' -eq $InstallDirectory) +{ + $personalModules = Join-Path -Path ([Environment]::GetFolderPath('MyDocuments')) -ChildPath WindowsPowerShell\Modules + + if (($env:PSModulePath -split ';') -notcontains $personalModules) { + Write-Warning "$personalModules is not in `$env:PSModulePath" + } + + if (!(Test-Path $personalModules)) { + Write-Error "$personalModules does not exist" + } + + $InstallDirectory = Join-Path -Path $personalModules -ChildPath ImportExcel +} + +if (!(Test-Path $InstallDirectory)) { + $null = mkdir $InstallDirectory +} + +$wc = New-Object System.Net.WebClient +$fileList | + ForEach-Object { + $wc.DownloadFile("https://raw.github.com/dfinke/ImportExcel/master/$_","$installDirectory\$_") + } \ No newline at end of file