mal wieder etwas verfeinert. 3 verschiedene Downloadmethoden: invoke webrequest (sehr langsam), bitsadmin und Start-BitsTransfer.
Für die aktuelle Version von Winget (aktueller Stand 25.02.2025: v1.10.320):
winget install_invoke webrequest.cmd
Code: Alles auswählen
@Echo off
chcp 1252 >nul
setlocal enabledelayedexpansion
:: Bestimme das aktuelle Skriptverzeichnis
set "SCRIPT_DIR=%~dp0"
:: Variablen für lokale Dateipfade
set "DEPENDENCIES_ZIP=%SCRIPT_DIR%DesktopAppInstaller_Dependencies.zip"
set "DEPENDENCIES_FOLDER=%SCRIPT_DIR%DesktopAppInstaller_Dependencies"
set "WINGET_INSTALLER=%SCRIPT_DIR%MicrosoftDesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
:: Variablen für URLs
set "DEPENDENCIES_URL=https://github.com/microsoft/winget-cli/releases/download/v1.10.320/DesktopAppInstaller_Dependencies.zip"
set "WINGET_URL=https://github.com/microsoft/winget-cli/releases/download/v1.10.320/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
echo Downloade und installiere Abhängigkeiten...
:: Download mit Invoke-WebRequest (PowerShell)
powershell -command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri '!DEPENDENCIES_URL!' -OutFile '!DEPENDENCIES_ZIP!'"
powershell -command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri '!WINGET_URL!' -OutFile '!WINGET_INSTALLER!'"
:: Stelle sicher, dass das Zielverzeichnis existiert
if not exist "%DEPENDENCIES_FOLDER%" mkdir "%DEPENDENCIES_FOLDER%"
:: Entpacken direkt in das Skriptverzeichnis
powershell -command "Expand-Archive -Path '!DEPENDENCIES_ZIP!' -DestinationPath '!SCRIPT_DIR!' -Force"
:: Falls ein doppelter Unterordner entstanden ist, korrigieren
if exist "%SCRIPT_DIR%DesktopAppInstaller_Dependencies\DesktopAppInstaller_Dependencies\x64" (
move "%SCRIPT_DIR%DesktopAppInstaller_Dependencies\DesktopAppInstaller_Dependencies\x64" "%DEPENDENCIES_FOLDER%"
rmdir /s /q "%SCRIPT_DIR%DesktopAppInstaller_Dependencies\DesktopAppInstaller_Dependencies"
)
:: Abhängigkeiten installieren
echo Installiere Abhängigkeiten...
powershell -command "Add-AppXPackage -Path '%DEPENDENCIES_FOLDER%\x64\Microsoft.UI.Xaml.2.8_8.2501.31001.0_x64.appx'"
powershell -command "Add-AppXPackage -Path '%DEPENDENCIES_FOLDER%\x64\Microsoft.VCLibs.140.00.UWPDesktop_14.0.33728.0_x64.appx'"
:: Winget installieren
echo Installiere Winget...
powershell -command "Add-AppXPackage -Path '%WINGET_INSTALLER%'"
echo Installation abgeschlossen.
:: Winget testen
winget list --accept-source-agreements
pause >nul
endlocal
exit /b
winget install_bitsadmin.cmd
Code: Alles auswählen
@Echo off
chcp 1252 >nul
setlocal enabledelayedexpansion
:: Bestimme das aktuelle Skriptverzeichnis
set "SCRIPT_DIR=%~dp0"
:: Variablen für lokale Dateipfade
set "DEPENDENCIES_ZIP=%SCRIPT_DIR%DesktopAppInstaller_Dependencies.zip"
set "DEPENDENCIES_FOLDER=%SCRIPT_DIR%DesktopAppInstaller_Dependencies"
set "WINGET_INSTALLER=%SCRIPT_DIR%MicrosoftDesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
:: Variablen für URLs
set "DEPENDENCIES_URL=https://github.com/microsoft/winget-cli/releases/download/v1.10.320/DesktopAppInstaller_Dependencies.zip"
set "WINGET_URL=https://github.com/microsoft/winget-cli/releases/download/v1.10.320/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
echo Downloade und installiere Abhängigkeiten...
:: Schneller Download mit BITSAdmin
bitsadmin /transfer "Download1" "%DEPENDENCIES_URL%" "%DEPENDENCIES_ZIP%"
bitsadmin /transfer "Download2" "%WINGET_URL%" "%WINGET_INSTALLER%"
:: Stelle sicher, dass das Zielverzeichnis existiert
if not exist "%DEPENDENCIES_FOLDER%" mkdir "%DEPENDENCIES_FOLDER%"
:: Entpacken direkt in das Skriptverzeichnis
powershell -command "Expand-Archive -Path '%DEPENDENCIES_ZIP%' -DestinationPath '%SCRIPT_DIR%' -Force"
:: Falls ein doppelter Unterordner entstanden ist, korrigieren
if exist "%SCRIPT_DIR%DesktopAppInstaller_Dependencies\DesktopAppInstaller_Dependencies\x64" (
move "%SCRIPT_DIR%DesktopAppInstaller_Dependencies\DesktopAppInstaller_Dependencies\x64" "%DEPENDENCIES_FOLDER%"
rmdir /s /q "%SCRIPT_DIR%DesktopAppInstaller_Dependencies\DesktopAppInstaller_Dependencies"
)
:: Abhängigkeiten installieren
echo Installiere Abhängigkeiten...
powershell -command "Add-AppXPackage -Path '%DEPENDENCIES_FOLDER%\x64\Microsoft.UI.Xaml.2.8_8.2501.31001.0_x64.appx'"
powershell -command "Add-AppXPackage -Path '%DEPENDENCIES_FOLDER%\x64\Microsoft.VCLibs.140.00.UWPDesktop_14.0.33728.0_x64.appx'"
:: Winget installieren
echo Installiere Winget...
powershell -command "Add-AppXPackage -Path '%WINGET_INSTALLER%'"
echo Installation abgeschlossen.
:: Winget testen
winget list --accept-source-agreements
pause >nul
endlocal
exit /b
winget install_Start-BitsTransfer.cmd
Code: Alles auswählen
@Echo off
chcp 1252 >nul
setlocal enabledelayedexpansion
:: Bestimme das aktuelle Skriptverzeichnis
set "SCRIPT_DIR=%~dp0"
:: Variablen für lokale Dateipfade
set "DEPENDENCIES_ZIP=%SCRIPT_DIR%DesktopAppInstaller_Dependencies.zip"
set "DEPENDENCIES_FOLDER=%SCRIPT_DIR%DesktopAppInstaller_Dependencies"
set "WINGET_INSTALLER=%SCRIPT_DIR%MicrosoftDesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
:: Variablen für URLs
set "DEPENDENCIES_URL=https://github.com/microsoft/winget-cli/releases/download/v1.10.320/DesktopAppInstaller_Dependencies.zip"
set "WINGET_URL=https://github.com/microsoft/winget-cli/releases/download/v1.10.320/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
echo Downloade und installiere Abhängigkeiten...
:: Schneller Download mit Start-BitsTransfer (PowerShell)
powershell -command "Start-BitsTransfer -Source '!DEPENDENCIES_URL!' -Destination '!DEPENDENCIES_ZIP!'"
powershell -command "Start-BitsTransfer -Source '!WINGET_URL!' -Destination '!WINGET_INSTALLER!'"
:: Stelle sicher, dass das Zielverzeichnis existiert
if not exist "%DEPENDENCIES_FOLDER%" mkdir "%DEPENDENCIES_FOLDER%"
:: Entpacken direkt in das Skriptverzeichnis
powershell -command "Expand-Archive -Path '!DEPENDENCIES_ZIP!' -DestinationPath '!SCRIPT_DIR!' -Force"
:: Falls ein doppelter Unterordner entstanden ist, korrigieren
if exist "%SCRIPT_DIR%DesktopAppInstaller_Dependencies\DesktopAppInstaller_Dependencies\x64" (
move "%SCRIPT_DIR%DesktopAppInstaller_Dependencies\DesktopAppInstaller_Dependencies\x64" "%DEPENDENCIES_FOLDER%"
rmdir /s /q "%SCRIPT_DIR%DesktopAppInstaller_Dependencies\DesktopAppInstaller_Dependencies"
)
:: Abhängigkeiten installieren
echo Installiere Abhängigkeiten...
powershell -command "Add-AppXPackage -Path '%DEPENDENCIES_FOLDER%\x64\Microsoft.UI.Xaml.2.8_8.2501.31001.0_x64.appx'"
powershell -command "Add-AppXPackage -Path '%DEPENDENCIES_FOLDER%\x64\Microsoft.VCLibs.140.00.UWPDesktop_14.0.33728.0_x64.appx'"
:: Winget installieren
echo Installiere Winget...
powershell -command "Add-AppXPackage -Path '%WINGET_INSTALLER%'"
echo Installation abgeschlossen.
:: Winget testen
winget list --accept-source-agreements
pause >nul
endlocal
exit /b
Die Zeilen in den Windows Editor kloppen und als ANSI speichern (wegen der Umlaute).
Nachteil: das Script muss von Zeit zu Zeit angepasst werden, da dort statische Versionsnummern drin stehen:
https://github.com/microsoft/winget-cli ... /download/ v1.10.320 /DesktopAppInstaller_Dependencies.zip
Die Dependencies ändern sich ebenfalls von Zeit zu Zeit.
Viel Spaß!
mal wieder etwas verfeinert. 3 verschiedene Downloadmethoden: invoke webrequest (sehr langsam), bitsadmin und Start-BitsTransfer.
Für die aktuelle Version von Winget (aktueller Stand 25.02.2025: v1.10.320):
winget install_invoke webrequest.cmd
[code]@Echo off
chcp 1252 >nul
setlocal enabledelayedexpansion
:: Bestimme das aktuelle Skriptverzeichnis
set "SCRIPT_DIR=%~dp0"
:: Variablen für lokale Dateipfade
set "DEPENDENCIES_ZIP=%SCRIPT_DIR%DesktopAppInstaller_Dependencies.zip"
set "DEPENDENCIES_FOLDER=%SCRIPT_DIR%DesktopAppInstaller_Dependencies"
set "WINGET_INSTALLER=%SCRIPT_DIR%MicrosoftDesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
:: Variablen für URLs
set "DEPENDENCIES_URL=https://github.com/microsoft/winget-cli/releases/download/v1.10.320/DesktopAppInstaller_Dependencies.zip"
set "WINGET_URL=https://github.com/microsoft/winget-cli/releases/download/v1.10.320/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
echo Downloade und installiere Abhängigkeiten...
:: Download mit Invoke-WebRequest (PowerShell)
powershell -command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri '!DEPENDENCIES_URL!' -OutFile '!DEPENDENCIES_ZIP!'"
powershell -command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri '!WINGET_URL!' -OutFile '!WINGET_INSTALLER!'"
:: Stelle sicher, dass das Zielverzeichnis existiert
if not exist "%DEPENDENCIES_FOLDER%" mkdir "%DEPENDENCIES_FOLDER%"
:: Entpacken direkt in das Skriptverzeichnis
powershell -command "Expand-Archive -Path '!DEPENDENCIES_ZIP!' -DestinationPath '!SCRIPT_DIR!' -Force"
:: Falls ein doppelter Unterordner entstanden ist, korrigieren
if exist "%SCRIPT_DIR%DesktopAppInstaller_Dependencies\DesktopAppInstaller_Dependencies\x64" (
move "%SCRIPT_DIR%DesktopAppInstaller_Dependencies\DesktopAppInstaller_Dependencies\x64" "%DEPENDENCIES_FOLDER%"
rmdir /s /q "%SCRIPT_DIR%DesktopAppInstaller_Dependencies\DesktopAppInstaller_Dependencies"
)
:: Abhängigkeiten installieren
echo Installiere Abhängigkeiten...
powershell -command "Add-AppXPackage -Path '%DEPENDENCIES_FOLDER%\x64\Microsoft.UI.Xaml.2.8_8.2501.31001.0_x64.appx'"
powershell -command "Add-AppXPackage -Path '%DEPENDENCIES_FOLDER%\x64\Microsoft.VCLibs.140.00.UWPDesktop_14.0.33728.0_x64.appx'"
:: Winget installieren
echo Installiere Winget...
powershell -command "Add-AppXPackage -Path '%WINGET_INSTALLER%'"
echo Installation abgeschlossen.
:: Winget testen
winget list --accept-source-agreements
pause >nul
endlocal
exit /b
[/code]
winget install_bitsadmin.cmd
[code]@Echo off
chcp 1252 >nul
setlocal enabledelayedexpansion
:: Bestimme das aktuelle Skriptverzeichnis
set "SCRIPT_DIR=%~dp0"
:: Variablen für lokale Dateipfade
set "DEPENDENCIES_ZIP=%SCRIPT_DIR%DesktopAppInstaller_Dependencies.zip"
set "DEPENDENCIES_FOLDER=%SCRIPT_DIR%DesktopAppInstaller_Dependencies"
set "WINGET_INSTALLER=%SCRIPT_DIR%MicrosoftDesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
:: Variablen für URLs
set "DEPENDENCIES_URL=https://github.com/microsoft/winget-cli/releases/download/v1.10.320/DesktopAppInstaller_Dependencies.zip"
set "WINGET_URL=https://github.com/microsoft/winget-cli/releases/download/v1.10.320/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
echo Downloade und installiere Abhängigkeiten...
:: Schneller Download mit BITSAdmin
bitsadmin /transfer "Download1" "%DEPENDENCIES_URL%" "%DEPENDENCIES_ZIP%"
bitsadmin /transfer "Download2" "%WINGET_URL%" "%WINGET_INSTALLER%"
:: Stelle sicher, dass das Zielverzeichnis existiert
if not exist "%DEPENDENCIES_FOLDER%" mkdir "%DEPENDENCIES_FOLDER%"
:: Entpacken direkt in das Skriptverzeichnis
powershell -command "Expand-Archive -Path '%DEPENDENCIES_ZIP%' -DestinationPath '%SCRIPT_DIR%' -Force"
:: Falls ein doppelter Unterordner entstanden ist, korrigieren
if exist "%SCRIPT_DIR%DesktopAppInstaller_Dependencies\DesktopAppInstaller_Dependencies\x64" (
move "%SCRIPT_DIR%DesktopAppInstaller_Dependencies\DesktopAppInstaller_Dependencies\x64" "%DEPENDENCIES_FOLDER%"
rmdir /s /q "%SCRIPT_DIR%DesktopAppInstaller_Dependencies\DesktopAppInstaller_Dependencies"
)
:: Abhängigkeiten installieren
echo Installiere Abhängigkeiten...
powershell -command "Add-AppXPackage -Path '%DEPENDENCIES_FOLDER%\x64\Microsoft.UI.Xaml.2.8_8.2501.31001.0_x64.appx'"
powershell -command "Add-AppXPackage -Path '%DEPENDENCIES_FOLDER%\x64\Microsoft.VCLibs.140.00.UWPDesktop_14.0.33728.0_x64.appx'"
:: Winget installieren
echo Installiere Winget...
powershell -command "Add-AppXPackage -Path '%WINGET_INSTALLER%'"
echo Installation abgeschlossen.
:: Winget testen
winget list --accept-source-agreements
pause >nul
endlocal
exit /b
[/code]
winget install_Start-BitsTransfer.cmd
[code]@Echo off
chcp 1252 >nul
setlocal enabledelayedexpansion
:: Bestimme das aktuelle Skriptverzeichnis
set "SCRIPT_DIR=%~dp0"
:: Variablen für lokale Dateipfade
set "DEPENDENCIES_ZIP=%SCRIPT_DIR%DesktopAppInstaller_Dependencies.zip"
set "DEPENDENCIES_FOLDER=%SCRIPT_DIR%DesktopAppInstaller_Dependencies"
set "WINGET_INSTALLER=%SCRIPT_DIR%MicrosoftDesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
:: Variablen für URLs
set "DEPENDENCIES_URL=https://github.com/microsoft/winget-cli/releases/download/v1.10.320/DesktopAppInstaller_Dependencies.zip"
set "WINGET_URL=https://github.com/microsoft/winget-cli/releases/download/v1.10.320/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
echo Downloade und installiere Abhängigkeiten...
:: Schneller Download mit Start-BitsTransfer (PowerShell)
powershell -command "Start-BitsTransfer -Source '!DEPENDENCIES_URL!' -Destination '!DEPENDENCIES_ZIP!'"
powershell -command "Start-BitsTransfer -Source '!WINGET_URL!' -Destination '!WINGET_INSTALLER!'"
:: Stelle sicher, dass das Zielverzeichnis existiert
if not exist "%DEPENDENCIES_FOLDER%" mkdir "%DEPENDENCIES_FOLDER%"
:: Entpacken direkt in das Skriptverzeichnis
powershell -command "Expand-Archive -Path '!DEPENDENCIES_ZIP!' -DestinationPath '!SCRIPT_DIR!' -Force"
:: Falls ein doppelter Unterordner entstanden ist, korrigieren
if exist "%SCRIPT_DIR%DesktopAppInstaller_Dependencies\DesktopAppInstaller_Dependencies\x64" (
move "%SCRIPT_DIR%DesktopAppInstaller_Dependencies\DesktopAppInstaller_Dependencies\x64" "%DEPENDENCIES_FOLDER%"
rmdir /s /q "%SCRIPT_DIR%DesktopAppInstaller_Dependencies\DesktopAppInstaller_Dependencies"
)
:: Abhängigkeiten installieren
echo Installiere Abhängigkeiten...
powershell -command "Add-AppXPackage -Path '%DEPENDENCIES_FOLDER%\x64\Microsoft.UI.Xaml.2.8_8.2501.31001.0_x64.appx'"
powershell -command "Add-AppXPackage -Path '%DEPENDENCIES_FOLDER%\x64\Microsoft.VCLibs.140.00.UWPDesktop_14.0.33728.0_x64.appx'"
:: Winget installieren
echo Installiere Winget...
powershell -command "Add-AppXPackage -Path '%WINGET_INSTALLER%'"
echo Installation abgeschlossen.
:: Winget testen
winget list --accept-source-agreements
pause >nul
endlocal
exit /b
[/code]
Die Zeilen in den Windows Editor kloppen und als ANSI speichern (wegen der Umlaute).
Nachteil: das Script muss von Zeit zu Zeit angepasst werden, da dort statische Versionsnummern drin stehen:
https://github.com/microsoft/winget-cli/releases/download/ [b][i][u]v1.10.320[/u][/i][/b] /DesktopAppInstaller_Dependencies.zip
Die Dependencies ändern sich ebenfalls von Zeit zu Zeit.
Viel Spaß!