I had the same issue.
I used the following script and works for me. I used IA to find the correct one.
@echo off
SET input=%1
REM Verificar si se proporcionó un argumento
IF "%input%"=="" (
echo Error: No se proporcionó una dirección en el formato telnet:host:puerto
exit /b 1
)
REM Extraer correctamente el host y el puerto
FOR /F "tokens=2 delims=:" %%a IN ("%input%") DO SET host=%%a
FOR /F "tokens=3 delims=:" %%a IN ("%input%") DO SET port=%%a
REM Quitar barras "//" si las hay
SET host=%host://=%
SET port=%port:/=%
REM Eliminar espacios en host y puerto
SET host=%host: =%
SET port=%port: =%
REM Validar que ambos valores existen
IF "%host%"=="" (
echo Error: Host no identificado
exit /b 1
)
IF "%port%"=="" (
echo Error: Puerto no identificado
exit /b 1
)
echo Host: %host%
echo Puerto: %port%
REM Ir a la carpeta de MobaXterm
cd /d "C:\Program Files (x86)\Mobatek\MobaXterm" || (
echo Error: No se encontró la carpeta de MobaXterm
exit /b 1
)
REM Ejecutar Telnet en MobaXterm con el formato correcto
MobaXterm.exe -newtab "cmd /c telnet %host% %port%"
Best,