@echo off setlocal EnableExtensions title Switch Connection Utility set "SSH_USER=perelygin" :START cls echo =============================== echo Switch Connection Utility echo =============================== echo. set "SWITCH_IP=" set /p "SWITCH_IP=Enter switch IP address or hostname: " if not defined SWITCH_IP ( echo. echo No address entered. pause goto START ) echo. echo Select connection protocol: echo 1 - SSH echo 2 - TELNET echo. set "PROTO=" set /p "PROTO=Enter your choice (default: 1): " if not defined PROTO set "PROTO=1" if "%PROTO%"=="1" goto SSH if "%PROTO%"=="2" goto TELNET echo. echo Invalid selection. pause goto START :SSH echo. echo Connecting via SSH to %SSH_USER%@%SWITCH_IP% ... echo. powershell -NoProfile -Command "ssh -o KexAlgorithms=+diffie-hellman-group14-sha1 -o HostKeyAlgorithms=+ssh-rsa -o Ciphers=+aes128-cbc -o MACs=+hmac-sha1 %SSH_USER%@%SWITCH_IP%" goto ASK_NEXT :TELNET echo. echo Connecting via Telnet to %SWITCH_IP% ... echo. powershell -NoProfile -Command "telnet %SWITCH_IP%" goto ASK_NEXT :ASK_NEXT echo. echo Session finished. echo. echo Connect to another switch? echo 1 - No echo 2 - Yes echo. set "NEXT_CHOICE=" set /p "NEXT_CHOICE=Enter your choice (default: 1): " if not defined NEXT_CHOICE set "NEXT_CHOICE=1" if "%NEXT_CHOICE%"=="1" exit /b if "%NEXT_CHOICE%"=="2" goto START echo. echo Invalid selection. pause exit /b