@echo off setlocal for /f "usebackq delims=" %%U in (`powershell -NoProfile -Command "$os = Get-CimInstance Win32_OperatingSystem; $up = (Get-Date) - $os.LastBootUpTime; '{0:yyyy-MM-dd HH:mm:ss};{1:N1};{2}' -f $os.LastBootUpTime, $up.TotalHours, $os.Caption"`) do ( for /f "tokens=1,2,* delims=;" %%A in ("%%U") do ( echo Boot time: %%A echo Uptime hours: %%B echo OS: %%C ) ) exit /b 0