Can I run the "open" command such that the window is not visible?

Advertisement

cag8f
Joined:
Posts:
9

Can I run the "open" command such that the window is not visible?

Hi all. I'm just getting started with WinSCP scripting, and have a question about the open command. When I run this command, it opens a visible WinSCP.com window. But is it possible to run this command such that the WinSCP.com window is not visible? I'd like to run a small script in the background that does not interfere/distract the user. The script downloads a small file via SFTP.

If this is not possible with open, might there be another approach I could take to achieve what I want?

Thanks in advance.

Reply with quote

Advertisement

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

Re: Can I run the "open" command such that the window is not visible?

The open does not open any window. It's mere starting of the winscp.com that causes Windows to create a console window (as the winscp.com is a console application).

If you do not want the console window, use the winscp.exe instead:
https://winscp.net/eng/docs/executables

Reply with quote

cag8f
Joined:
Posts:
9

Ah of course, my mistake.
open
is used to open an SFTP connection. It is the statement in my BAT file:

"C:\Program Files (x86)\WinSCP\winscp.com" /script=htaccess-script.txt

that needs to be edited (if possible) so that winscp.com runs in the background. Any ideas how to do that off the top of your head?

Reply with quote

cag8f
Joined:
Posts:
9

Whoops, sorry--I thought that line was part of your signature. Changing to winscp.exe improves it, but this time a Windows command prompt window is open during the process, instead of winscp.com. No worries, I think I can live with it or re-visit it if it becomes an issue. I read in another forum that if I schedule a Windows Task to run the BAT file on a regular basis, a window will not appear--I'll test that.

Thanks for the help.

Reply with quote

Advertisement

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

cag8f wrote:

Changing to winscp.exe improves it, but this time a Windows command prompt window is open during the process, instead of winscp.com.
But that has nothing to do with WinSCP.
Does your batch file do anything else apart from running WinSCP?
If not, skip the batch file and run WinSCP directly.
Otherwise, see https://superuser.com/q/62525/213663

Reply with quote

Advertisement

You can post new topics in this forum