Ms dos

black ji Messages postés 3 Date d'inscription   Statut Membre Dernière intervention   -  
BeFaX Messages postés 16334 Statut Contributeur -
Bonjour, Bonjour, je voudrais realiser un script en bach dos sous windows qui affiche les caracteristique d'un ordinateur (cpu;memoires....).merci d'avance.

1 réponse

  1. BeFaX Messages postés 16334 Statut Contributeur 3 863
     
    En voici un petit créé par mes soins :
    dxdiag /t %temp%\dxdiag.txt
    
    (echo.
    echo  ^|======================================================^|
    echo  ^|      Résumé de l'ordinateur                          ^|
    echo  ^|======================================================^|
    echo  ^|)>boot.txt
    for /f "tokens=1,2* delims=:" %%a in ('type %temp%\dxdiag.txt ^| find "System Manufacturer"') do echo  ^|  Carte mère  : %%b >>boot.txt
    for /f "tokens=1,2* delims=:" %%a in ('type %temp%\dxdiag.txt ^| find "System Model"') do echo  ^|  Modèle      : %%b >>boot.txt
    for /f "tokens=1,2,3* delims=:" %%a in ('type %temp%\dxdiag.txt ^| find "Processor"') do call :del %%b
    for /f "tokens=1,2* delims=]" %%a in ('type 01.tmp') do (
    echo  ^|  Processeur  :  %%a
    echo  ^|  Modèle      :  %%b
    )>>boot.txt
    if exist 01.tmp del /F /Q 01.tmp >NUL
    goto nextr
    :del
    set var=%*
    set var=%var:     =]%
    echo %var%>01.tmp
    goto :eof
    :nextr
    for /f "tokens=1,2* delims=:" %%a in ('type %temp%\dxdiag.txt ^| find "   Memory"') do echo  ^|  Mémoire     : %%b >>boot.txt
    for /f "tokens=1,2* delims=:" %%a in ('type %temp%\dxdiag.txt ^| find "Machine name"') do echo  ^|  Nom PC      : %%b >>boot.txt
    for /f "tokens=1,2* delims=:" %%a in ('type %temp%\dxdiag.txt ^| find "DirectX Version"') do echo  ^|  DirectX     : %%b >>boot.txt
    echo  ^|>>boot.txt
    for /f "tokens=1,2* delims=:" %%a in ('type %temp%\dxdiag.txt ^| find "Card name"') do echo  ^|  Carte Graph.: %%b >>boot.txt
    for /f "tokens=1,2* delims=:" %%a in ('type %temp%\dxdiag.txt ^| find "Display Memory"') do echo  ^|  Mém. Graph  : %%b >>boot.txt
    for /f "tokens=1,2* delims=:" %%a in ('type %temp%\dxdiag.txt ^| find "Monitor Model"') do echo  ^|  Ecran       : %%b >>boot.txt
    for /f "tokens=1,2* delims=:" %%a in ('type %temp%\dxdiag.txt ^| find "Driver Date/Size"') do echo  ^|  Drivers     : %%b %%c >>boot.txt
    start boot.txt 
    exit
    0