setlocal
for /f "usebackq delims=" %%B in (`hostname`) do set HOSTNAME=%%B
for /f "usebackq tokens=* skip=1" %%A in (`wmic os get caption`) do if not defined OSNAME set OSNAME=%%A
for /f "usebackq delims=" %%C in (`ver`) do set WVER=%%C
echo %HOSTNAME%,%date%,%time%,%OSNAME%,%WVER:Microsoft Windows =% >> %1\%HOSTNAME%_osver.csv
endlocal
