2184 mal gelesen
WinGet is a very handy tool for installing software in Windows. It can be combined e. g. with FOG snapins (the benefit is having the latest software version whenever a snapin is run and not having to update the snapin itself.)
WinGet is, however, not natively accessible from the SYSTEM account. I have developed a workaround batch script which does the following:
First, it looks inside the Program Files folder for winget.exe. If it can’t find the file (e. g. because it is not launched with administrative rights) it will abort. If it finds the file it will launch a command of your choice, here it will print the file name and then start winget to list all installed packages. If you want to automate make sure to remove all „pause“ lines! 😉
@ECHO off echo This program only works with administrative rights! (C) www.Langer.ws REM Look for winget.exe... cd "C:\Program Files\WindowsApps" if errorlevel = 1 goto FEHLER if errorlevel = 0 goto WEITER :FEHLER echo This program only works with administrative rights! echo Program aborted. pause exit :WEITER for /r %%x in (*winget.exe) do set "name=%%x" REM switch back to the original directory cd %~dp0 REM Path of winget.exe should be contained in variable %name%; here come your commands... echo %name% "%name%" list pause