@echo off
setlocal enabledelayedexpansion
echo %* | findstr /c:"--scan" >nul
if %errorlevel%==0 (
echo {"json_format_version":[1,0],"smartctl":{"version":[7,5],"svn_revision":"5714","platform_info":"x86_64-w64-mingw32-w10-22H2","build_info":"(AppVeyor)","argv":["smartctl","--scan","-j"],"exit_status":0},"devices":[{"name":"/dev/sda","info_name":"/dev/sda","type":"ata","protocol":"ATA"},{"name":"/dev/sdb","info_name":"/dev/sdb","type":"ata","protocol":"ATA"}]}
exit /b 0
)
set "args=%*"
set "args=!args:/dev/sda=/dev/csmi0,0!"
set "args=!args:/dev/sdb=/dev/csmi0,1!"
"C:\Program Files\smartmontools\bin\smartctl.exe" !args! > "%TEMP%\z_smart.json"
powershell -NoProfile -Command "(Get-Content '%TEMP%\z_smart.json' -Raw) -replace 'csmi0,0', 'sda' -replace 'csmi0,1', 'sdb' -replace '\"csmi\"', '\"ata\"'"
exit /b 0