PC情報をtxtに書き出す

@echo off

 

ver | find /i "Version 5.0." > nul

if %ERRORLEVEL% equ 0 GOTO :2000

ver | find /i "Version 5.1." > nul

if %ERRORLEVEL% equ 0 GOTO :XP

 

ver | find /i "Version 6.0." > nul

if %ERRORLEVEL% equ 0 GOTO :Vista

 

ver | find /i "Version 6.1." > nul

if %ERRORLEVEL% equ 0 GOTO :WIN7

ver | find /i "Version 6.2." > nul

if %ERRORLEVEL% equ 0 GOTO :WIN8

ver | find /i "Version 6.3." > nul

if %ERRORLEVEL% equ 0 GOTO :WIN8.1

ver | find /i "Version 10.0." > nul

if %ERRORLEVEL% equ 0 GOTO :WIN10

goto :OTHER

 

 

:2000

echo

echo この端末の OS は "Windows 2000" です。 >> PClist.txt

echo.

goto END

:XP

echo.

echo この端末の OS は "Windows XP" です。 >> PClist.txt

echo.

goto END

 

:Vista

echo.

echo この端末の OS は "Windows Vista" です。 >> PClist.txt

echo.

goto END

 

:WIN7

echo

echo この端末の OS は "Windows 7" です。 >> PClist.txt

echo.

goto END

 

:WIN8

echo.

echo この端末の OS は "Windows 8" です。 >> PClist.txt

echo.

goto END

 

:WIN8.1

echo.

echo この端末の OS は "Windows 8.1" です。 >> PClist.txt

echo.

goto END

 

:WIN10

echo.

echo この端末の OS は "Windows 10" です。 >> PClist.txt

echo.

goto END

 

:OTHER

echo.

echo それ以外の OS です。 >> PClist.txt

echo.

goto END

 

:END

echo.

 

rem 関連付け判定  Wordなら .docx  Excelなら .xlsx

for /f "tokens=2 delims==" %%a in ('assoc .docx') do @set workrel=%%a

for /f "tokens=2 delims==" %%a in ('ftype %workrel%') do @set workpath=%%a

 

rem インストール判定  Wordなら winword.exe  Excelなら excel.exe

echo %workpath% | find /i "winword.exe" >NUL  >> PClist.txt

if %errorlevel% geq 1 goto notinst

 

echo ユーザー名は

echo %username%

echo ユーザー名は %username% >> PClist.txt

 

echo このPC名は 

echo %COMPUTERNAME%

 

echo このPC名は %COMPUTERNAME% >> PClist.txt

 

 

@echo off

setlocal

 

if "%PROCESSOR_ARCHITECTURE%" EQU "x86" (

    echo "32bit" >> PClist.txt

)

if "%PROCESSOR_ARCHITECTURE%" NEQ "x86" (

    echo "64bit" >> PClist.txt

)

 

 

@ECHO OFF

ECHO.

ECHO ●ユーザ名とIPアドレスを教えてください 

ECHO.

FOR /F %%i IN ('whoami') DO SET wai=%%i 

 

 

 

echo ユーザ名 %wai% >> PClist.txt

 

ECHO.

FOR /F "delims=" %%a IN ('arp -a ^| findstr "インターフェイス:"') DO (

ECHO %%a | FIND "192" >NUL

IF NOT ERRORLEVEL 1 (SET ipa=%%a)

)

SET ipa=%ipa:インターフェイス: =%

 

ECHO IPアドレス %ipa% >> PClist.txt

 

@echo off

 

setlocal

for /f "tokens=4,5 delims=. " %%a in ('ver') do set "version=%%a%%b"

 

 

if version lss 62 (

    ::set "wmic_query=wmic desktopmonitor get screenheight, screenwidth /format:value"

    for /f "tokens=* delims=" %%@ in ('wmic desktopmonitor get screenwidth /format:value') do (

        for /f "tokens=2 delims==" %%# in ("%%@") do set "x=%%#"

    )

    for /f "tokens=* delims=" %%@ in ('wmic desktopmonitor get screenheight /format:value') do (

        for /f "tokens=2 delims==" %%# in ("%%@") do set "y=%%#"

    )

 

) else (

    ::wmic path Win32_VideoController get VideoModeDescription,CurrentVerticalResolution,CurrentHorizontalResolution /format:value

    for /f "tokens=* delims=" %%@ in ('wmic path Win32_VideoController get CurrentHorizontalResolution  /format:value') do (

        for /f "tokens=2 delims==" %%# in ("%%@") do set "x=%%#"

    )

    for /f "tokens=* delims=" %%@ in ('wmic path Win32_VideoController get CurrentVerticalResolution /format:value') do (

        for /f "tokens=2 delims==" %%# in ("%%@") do set "y=%%#"

    )

 

)

 

 

echo Resolution %x%x%y%

 

ECHO 解像度  %x%x%y% >> PClist.txt

 

endlocal

 

getmac /fo list >> PClist.txt

 

 

 

exit