🖥️ Batch (CMD)
Export Operating System Info to CSV (Batch)
Uses wmic to export Operating System Info (Win32_OperatingSystem) to a timestamped CSV file.
ExportOperatingSystemToCsv.bat
@echo off
:: ============================================================
:: ExportOperatingSystemToCsv.bat
::
:: Exports Operating System Info (Win32_OperatingSystem) to a timestamped CSV file next to
:: this script.
:: ============================================================
setlocal EnableDelayedExpansion
for /f "skip=1 tokens=1-2 delims=." %%a in ('wmic os get localdatetime') do if not defined LDT set LDT=%%a
set "OUTFILE=%~dp0operatingsystem_!LDT:~0,8!-!LDT:~8,6!.csv"
wmic path Win32_OperatingSystem get Caption,Version,OSArchitecture,LastBootUpTime,FreePhysicalMemory /format:csv > "%OUTFILE%"
echo Exported to "%OUTFILE%"
endlocal
pause