@cls
@echo OFF
echo.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: autmode
:: 0. Display prompt normally
:: 1. Run ProcessHacker with driver
:: 2. Run ProcessHacker without driver (portable mode)
:: 3. Uninstall driver
set automode=2
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::get os arch : http://blogs.msdn.com/b/david.wang/archive/2006/03/26/howto-detect-process-bitness.aspx
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto 64BIT
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto 64BIT
if "%PROCESSOR_ARCHITEW6432%"=="IA64" goto 64BIT
:: %~dp0 already has trailing path, while %CD% doesn't
:32BIT
echo ProcessHacker 32bit
set ProcessPath=%~dp0x86
if '%automode%'=='1' goto with_driver
if '%automode%'=='2' goto without_driver
if '%automode%'=='3' goto uninst_driver
goto prompt
:64BIT
echo ProcessHacker 64bit
set ProcessPath=%~dp0x64
if '%automode%'=='1' goto with_driver
if '%automode%'=='2' goto without_driver
if '%automode%'=='3' goto uninst_driver
goto prompt
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:prompt
echo.
echo ===========================
echo 1. Run ProcessHacker with driver
echo 2. Run ProcessHacker without driver (portable mode)
echo 3. Uninstall driver
echo 4. Quit
echo ===========================
echo Enter your choice
set /p choice={1,2,3,4}
if '%choice%'=='1' goto with_driver
if '%choice%'=='2' goto without_driver
if '%choice%'=='3' goto uninst_driver
if '%choice%'=='4' goto quit
goto error
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:with_driver
echo.
echo Running with driver
"%ProcessPath%\ProcessHacker.exe" -settings "ProcessHacker.cfg"
goto quit
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:without_driver
echo.
echo Running without driver
"%ProcessPath%\ProcessHacker.exe" -settings "ProcessHacker.cfg" -nokph
goto quit
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:uninst_driver
echo.
echo This operation can only be done manually
echo.
echo Step 1. Close ProcessHacker
echo Step 2. Go to "%ProcessPath%" folder and rename
echo "kprocesshacker.sys" to "kprocesshacker.sys.old"
echo Step 3. Run ProcessHacker with_driver (option 1) and then close ProcessHacker
echo Note: If you want to use the driver version again rename
echo "kprocesshacker.sys.old" back to "kprocesshacker.sys"
@pause
goto quit
:error
goto quit
:quit
::@pause
exit