Last active
September 24, 2022 15:39
-
-
Save Niktendo/e9fb462989bd819ee2a5a80283045784 to your computer and use it in GitHub Desktop.
Win7+-Scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $netshare = "H:\Neuer Ordner" | |
| $host.UI.RawUI.WindowTitle = "Herunterladen der Abhaengigkeiten..." | |
| $params="%*" | |
| function Expand-ZIPFile($file, $destination) | |
| { | |
| $shell = new-object -com shell.application | |
| $zip = $shell.NameSpace($file) | |
| foreach($item in $zip.items()) | |
| { | |
| $shell.Namespace($destination).copyhere($item) | |
| } | |
| } | |
| Remove-Item "$netshare\pwsh" -Recurse -force -ErrorAction Continue | |
| (New-Object System.Net.WebClient).DownloadFile('https://github.com/PowerShell/PowerShell/releases/download/v7.3.0-preview.8/PowerShell-7.3.0-preview.8-win-x64.zip',"$env:temp\pwsh.zip") | |
| Expand-ZipFile "$env:temp\pwsh.zip" -destination "$netshare\pwsh" | |
| Remove-Item "$env:temp\pwsh.zip" | |
| $value = "$netshare\pwsh" | |
| $path = [System.Environment]::GetEnvironmentVariable("PATH", [EnvironmentVariableTarget]::User) | |
| $new = ($path.Split(';') | Where-Object { $_ -ne "$value" }) -join ';' | |
| [System.Environment]::SetEnvironmentVariable("PATH", $new, [EnvironmentVariableTarget]::User) | |
| [System.Environment]::SetEnvironmentVariable("PATH", $new + ";$value", [EnvironmentVariableTarget]::User) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| echo %1 | |
| powershell -ExecutionPolicy Bypass -File %1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment