@ECHO Off rem Определяем разрядность системы rem По умолчанию IDA запустится с такой же разрядностью set xOS=x64& If "%PROCESSOR_ARCHITECTURE%"=="x86" (If Not Defined PROCESSOR_ARCHITEW6432 Set xOS=x86) rem Также считываем параметр строки переданный при запуске set param=%~1 rem На всякий случай бекапим файлы с настроек - вдруг у пользователя тоже есть IDA? xcopy /E /I /C /Y /Q /H /R "%appdata%\zynamics" ".\Backup\zynamics" xcopy /E /I /C /Y /Q /H /R "%appdata%\Hex-Rays" ".\Backup\Hex-Rays" xcopy /E /I /C /Y /Q /H /R "%appdata%\IDA Pro" ".\Backup\IDA Pro" rem Чистим папки, процедура описана ниже call :removedir "%appdata%\zynamics" call :removedir "%appdata%\Hex-Rays" call :removedir "%appdata%\IDA Pro" rem Копируем в профиль пользователя все необходимые файлы настроек xcopy /E /I /C /Y /Q /H /R ".\BinDiff\INI" "%appdata%\" xcopy /E /I /C /Y /Q /H /R ".\Hex-Rays" "%appdata%\" xcopy /E /I /C /Y /Q /H /R ".\Hex-Rays\IDA Pro" "%appdata%\IDA Pro" rem Бекапим ветку реестра IDA reg export HKEY_CURRENT_USER\Software\Hex-Rays backup.reg /y rem ... и перезаписываем своими параметрами reg import settings.reg rem Теперь посмотрим, какие параметры переданы в командной строке rem Это позволит запустить IDA в другой разрядности, например х32 в Windows x64 if "%param%"=="32" goto x32 if "%param%"=="64" goto x64 if "%param:~1%"=="32" goto x32 if "%param:~1%"=="64" goto x64 if "%xOS%"=="x64" goto x64 if "%xOS%"=="x32" goto x32 rem Запускаем IDA x32 и висим в виде резидента, ожидая завершения программы :x32 start /wait idaq.exe goto end rem Запускаем IDA x64 и висим в виде резидента, ожидая завершения программы :x64 start /wait idaq64.exe goto end rem Тут процедура удаления папок :removedir del /F /Q /S %1 > nul rmdir /s /q %1 exit /b rem И завершение работы :end rem Записываем настройки из реестра в файл reg export HKEY_CURRENT_USER\Software\Hex-Rays settings.reg /y rem ... а из профиля пользователя копируем все файлы xcopy /E /I /C /Y /Q /H /R "%appdata%\zynamics\*" ".\BinDiff\INI\zynamics" xcopy /E /I /C /Y /Q /H /R "%appdata%\Hex-Rays\*" ".\Hex-Rays" xcopy /E /I /C /Y /Q /H /R "%appdata%\IDA Pro" ".\Hex-Rays\IDA Pro" rem Чистим ветку реестра reg delete HKEY_CURRENT_USER\Software\Hex-Rays /f rem ... и восстанавливаем то, что там было до нас reg import backup.reg rem Чистим все хвосты del /F /Q backup.reg call :removedir "%appdata%\zynamics" call :removedir "%appdata%\Hex-Rays" call :removedir "%appdata%\IDA Pro" rem Восстанавливаем папки в профиле пользователя, которые были до запуска xcopy /E /I /C /Y /Q /H /R ".\Backup\*" "%appdata%\" rem ... и удаляем этот бекап call :removedir Backup
Source: https://habr.com/ru/post/438652/