Batch file -> How to keep window from popping up?

Advertisement

Guest

Batch file -> How to keep window from popping up?

Hi,

I am successfully using a batch file to download files from my ftp server. When it does so a window opens and see the name of every file being downloaded.
How do I keep this from showing up??

I do not want to see anything. I can get any info from the log file.

Reply with quote

Advertisement

Guest

Hide output window

My batch file is as follows and I thought the echo off would do the trick.

@echo off
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/command ^
"open ftp://anonymous:anonymous@10.19.1.100/" ^
"cd /" ^
"lcd ""C:\ILC""" ^
"get -delete S*.csv" ^
"exit"
exit

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
31,037
Location:
Prague, Czechia

Re: Hide output window

Redirect the output to nul:
@echo off
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /command ^
    	"open ftp://anonymous:anonymous@10.19.1.100/" ^
	"cd /" ^
	"lcd ""C:\ILC""" ^
    	"get -delete S*.csv" ^
    	"exit" > nul
exit

Reply with quote

Guest

Output window STILL there (but empty)

I added the > nul but the output window still appeared with title "anonymous@10.19.1.100 - WinSCP"
Nothing appeared in the window which I assume is due to the > nul.

Is there a way to keep this window from popping up at all??

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
31,037
Location:
Prague, Czechia

Re: Output window STILL there (but empty)

Anonymous wrote:

I added the > nul but the output window still appeared with title "anonymous@10.19.1.100 - WinSCP"
Nothing appeared in the window which I assume is due to the > nul.

Is there a way to keep this window from popping up at all??
I'm not sure I understand. You are running a Windows batch file. That batch file (not WinSCP) opens the console window. So do you want to run a batch file without a window?
Do you even need the batch file for anything? How do you run it?

Reply with quote

Advertisement

fncruz
Joined:
Posts:
5
Location:
USA

FTP

Martin,
I want SCP to go to a FTP and copy all csv files then delete them. I believe that the only way to do this is to automate using a batch file to call up SCP. This in turn brings up the COS window.

I would like to have everything run invisibly without any window popup.

Can this be done?

Thanks.

FC

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
31,037
Location:
Prague, Czechia

Re: FTP

Nothing you have written so far need a use of a batch file.

Avoid using batch file and you won't get any console window.

Or run batch file without a console window (what is not a WinSCP question).
See https://superuser.com/q/62525/213663

Reply with quote

fncruz
Joined:
Posts:
5
Location:
USA

"Nothing you have written so far need a use of a batch file"

I do not mind having WINScp open and running minimized but I cannot see how to automate.
How can automation be done without batch file?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
31,037
Location:
Prague, Czechia

fncruz wrote:

How can automation be done without batch file?
You run your batch file somehow - we do not know how - you have never told us.

A point of a batch file is to execute multiple commands. Yet your batch file has only one command - executing WinSCP. So the batch file is pointless. Instead of executing your single-command batch file, execute WinSCP directly - Replace execution of your batch file with execution of winscp.exe with the same arguments as you have in your batch file.
winscp.exe runs completely silently without any window.
https://winscp.net/eng/docs/executables

Reply with quote

Advertisement

You can post new topics in this forum