• If I understand the question, may I suggest that you use a bat to create a second bat and call that second one using the start /max
already finishing the first bat...
@echo off && >nul chcp 1252 & type nul >"%temp%\bat_to_bat.bat"
:: alterando o IP:
rem :: Configurando IP: 192.168.1.100 ^| Mascara: 255.255.255.0 ^| Gateway: 192.168.1.1
netsh interface ip set address name="Ethernet" static 192.168.1.100 255.255.255.0 192.168.1.1
rem :: Configurando DNS Primario: 1.1.1.1
netsh interface ip add dns "Ethernet" 1.1.1.1
rem :: DNS Secundario: 1.0.0.1
netsh interface ip add dns "Ethernet" 1.0.0.1 index=2
>"%temp%\bat_to_bat.bat"^
(
echo/ @echo off & color 0a
echo/ ssh [usuário]@192.168.1.1
echo/ [Senha]
) && start /max cmd.exe /k call "%temp%\bat_to_bat.bat" <nul & exit /b
Or with all the shares in one bat calling cmd and executing commands...4
@echo off && >nul chcp 1252 & type nul >"%temp%\bat_to_bat.bat"
>"%temp%\bat_to_bat.bat"^
(
echo/ @echo off & color 0a
echo/ rem :: Configurando IP: 192.168.1.100 ^| Mascara: 255.255.255.0 ^| Gateway: 192.168.1.1
echo/ netsh interface ip set address name="Ethernet" static 192.168.1.100 255.255.255.0 192.168.1.1
echo/ rem :: Configurando DNS Primario: 1.1.1.1
echo/ netsh interface ip add dns "Ethernet" 1.1.1.1
echo/ rem :: DNS Secundario: 1.0.0.1
echo/ netsh interface ip add dns "Ethernet" 1.0.0.1 index=2
echo/ ssh [usuário]@192.168.1.1
echo/ [senha]
echo/
) && start /max cmd.exe /k call "%temp%\bat_to_bat.bat" <nul & exit /b
• Obs.:
Edit/adjust the line with the ips netsh interface ip...
The bat needs to run as Administrator
I liked the technique of grouping the commands with "(" and ")" to create another file...normally I put ">" and then ">>" in each line...this technique I know from bash (where "(" and ")" delimit a sub-shell) but never thought of using in cmd
– zentrunix