How to open multiple sessions in CMD?

Advertisement

nx_massix
Guest

How to open multiple sessions in CMD?

Hi,
I wanted to create a small BAT-Script that opens multiple WinSCP-Sessions with IPs from a txt-file.
I already got to the point where it opens multiple WinSCP windows, but I just want one window with multiple Sessions.

My script so far:
set indexSystems=0
set indexKeys=0
 
for /F "usebackq delims=" %%a in ("C:\IP.txt") do (
    set /a indexSystems+=1
    set systems[!indexSystems!]=%%a
)
 
for /L %%i in (1,1,%indexSystems%) do (
 
   Start /B WinSCP.exe sftp://root:admin@!systems[%%i]! 
   
)
 
pause
Is there a way to open them in just one window?
br Markus

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,378
Location:
Prague, Czechia

Re: How to open multiple sessions in CMD?

The way you open the sessions would actually open them in existing WinSCP window, was the window idle. But as you open them quickly one after another, they open separately, as the window is probably still busy opening the previous session. If you put a delay in your loop, it should do.
timeout /T 5

Reply with quote

Advertisement

You can post new topics in this forum