How to open multiple files from remote servers for editing?

Advertisement

StartledLemon
Joined:
Posts:
2
Location:
UK

How to open multiple files from remote servers for editing?

Hello,

Firstly, thank you for WinSCP. Rarely a day goes by without me using the app, so thank you.

I regularly open a set of files from multiple remote servers. I've tried writing a small batch file to automate the opening of the files for editing in WinSCP's internal editor:
:: edit_files_winscp_ie.bat
@echo off
C:\Utilities\WinSCP\WinSCP.exe "host1" /edit /home/user/script1.sh
C:\Utilities\WinSCP\WinSCP.exe "host1" /edit /home/user/script2.sh
C:\Utilities\WinSCP\WinSCP.exe "host2" /edit /home/user/script1.sh
C:\Utilities\WinSCP\WinSCP.exe "host2" /edit /home/user/script2.sh
:eof

When I run the .bat file I see a blank Command Prompt window and the first script is opened in WinSCP's internal editor. However, I need to close the internal editor before the second script is opened, and I need to close that before the 3rd script is opened, etc...

Can I get all 4 scripts to open in the internal editor as soon as I run the .bat file?

Is it possible to hide the blank Command Prompt window? And one final question – is it possible to open the scripts in an external editor?

Thanks again!

Kind regards,

/Neil

Reply with quote

Advertisement

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

Re: How to open multiple files from remote servers for editing?

Can I get all 4 scripts to open in the internal editor as soon as I run the .bat file?
That's not really WinSCP question. Anyway, you can use the start command to start an application (WinSCP) without waiting for it to close:
start "" C:\Utilities\WinSCP\WinSCP.exe "host1" /edit /home/user/script1.sh
See also How to NOT wait for a process to complete in batch script?

Is it possible to hide the blank Command Prompt window?
Again, not really a WinSCP questiom. But see Run a batch file in a completely hidden way.

is it possible to open the scripts in an external editor?
It's not supported. It's difficult to implement. As most editors are tabbed nowadays, there's no clear process–file relation, so WinSCP won't be able to find out when you close the file, for it to be able to stop monitoring the file and exit itself. And as there won't be any WinSCP GUI, you won't be able to close WinSCP yourself easily. So you would end up with dangling hidden WinSCP process for each edited file.

Reply with quote

StartledLemon
Joined:
Posts:
2
Location:
UK

Re: How to open multiple files from remote servers for editing?

Hi Martin,

Thanks for the informative reply. It's all now working as expected, so thanks again.

/Neil

Reply with quote

Advertisement

You can post new topics in this forum