@echo off rem Diagnostic APINETWORK pour Windows XP a Windows 11. Lecture seule. Licence MIT. rem XP, Vista, 7 (NT 5.x et 6.0, 6.1) : WSH JScript. Windows 8 et plus (NT 6.2+) : PowerShell. rem Option : diagnostic.cmd /ancien force le collecteur WSH. setlocal cd /d "%~dp0" echo Diagnostic APINETWORK : lecture seule, aucune modification du systeme. echo Le rapport sera ecrit dans le dossier : %CD% echo. set "VERLINE=" for /f "tokens=2 delims=[]" %%a in ('ver') do set "VERLINE=%%a" set "VERNUM=" for /f "tokens=2 delims= " %%b in ("%VERLINE%") do set "VERNUM=%%b" set "VMAJ=0" set "VMIN=0" for /f "tokens=1,2 delims=." %%c in ("%VERNUM%") do ( set "VMAJ=%%c" set "VMIN=%%d" ) rem Hote 64 bits depuis une invite 32 bits : Sysnative donne l'outil natif. set "SYS=%SystemRoot%\System32" if exist "%SystemRoot%\Sysnative\cscript.exe" set "SYS=%SystemRoot%\Sysnative" set "PS=%SYS%\WindowsPowerShell\v1.0\powershell.exe" set "MODE=ps" if /i "%~1"=="/ancien" set "MODE=wsh" if %VMAJ% LSS 6 set "MODE=wsh" if %VMAJ% EQU 6 if %VMIN% LSS 2 set "MODE=wsh" if not exist "%PS%" set "MODE=wsh" if "%MODE%"=="ps" ( echo Windows %VERNUM% : collecteur PowerShell. "%PS%" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "%~dp0diagnostic.ps1" ) else ( echo Windows %VERNUM% : collecteur WSH. "%SYS%\cscript.exe" //NoLogo //E:JScript "%~dp0diagnostic-ancien.js" ) set "RC=%ERRORLEVEL%" echo. if not "%RC%"=="0" echo Le diagnostic s'est arrete avec le code %RC%. echo Appuyez sur une touche pour fermer cette fenetre. pause >nul endlocal