Facebook
From meew, 1 Month ago, written in Bash.
This paste is a reply to code from me - go back
Embed
Viewing differences between code and Re: code
@echo off
REM Check if the script is running with administrative privileges
net session >nul 2>&1
if %errorLevel% neq 0 (
    echo Administrative privileges required. Re-running script with elevated permissions...
    powershell -Command "Start-Process -Verb RunAs -FilePath '%0' -ArgumentList '%*'"
    exit /b
)

REM Now we are running with administrative privileges

pushd "%~dp0"

"%~dp0"

dir /b %SystemRoot%servicingPackages*Hyper-V*.%SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.>hyper-v.txt

for /f %%i in ('findstr ('findstr /i . hyper-v.txt 2^>nul') 2^>nul') do (
    
dism /online /norestart /add-package:"%SystemRoot%servicingPackages%%i"
)

/add-package:"%SystemRoot%\servicing\Packages\%%i"

del hyper-v.txt

REM Check if the Hyper-V feature is installed before attempting to enable it
dism /online /get-features | find "Microsoft-Hyper-V" >nul
if %errorlevel% equ 0 (
    
Dism /online /enable-feature /featurename:Microsoft-Hyper-V -All /LimitAccess /ALL
) else (
    echo Hyper-V feature not found or already enabled.
)

pause
/ALL

pause