How to force close cmd box on Win 10 after running script.

Advertisement

ukdeveloper
Joined:
Posts:
2
Location:
London UK

How to force close cmd box on Win 10 after running script.

Hi there, so I'm a scripting virgin but have managed to get something working.

I need to use Windows Task manager to schedule downloads (not sync) every 15 mins.

The code in a standard batch file I am using is:
# Connect to SFTP server using a password
open ftp://admin%40mysitedgoeshere.com:mypasswordhere@ftp.mysitegoeshere.com/ -explicittls
# Upload file
get -delete /track_uploads/*.file c:\playout\import\Presenters\
# Exit WinSCP
exit
The whole thing runs great apart from once the batch file is executed, it finishes with:
Press any key to continue
And until a key is pressed, the task remains open meaning the next scheduled task errors out.

Any advice on how to get around this would be great.

Reply with quote

Advertisement

ukdeveloper
Joined:
Posts:
2
Location:
London UK

Re: How to force close cmd box on Win 10 after running script.

Hi there,

Sorry for the late reply.

So I'm just running a batch file which runs CMD in Windows, carries out the WinSCP tasks and then SHOULD close. But does not.

This is what the batch file/cmd box shows:
C:\Program Files (x86)\WinSCP>winscp.com /script=importtracks.txt
Connecting to ftp.MYSITEHERE.com ...
TLS connection established. Waiting for welcome message...
Connected
Starting the session...
Session started.
Active session: [1] admin@MYSITEHERE.com@ftp.MYSITEHERE.com
No file matching '*.mp_' found.

C:\Program Files (x86)\WinSCP>pause
Press any key to continue . . .
This would be fine apart from this task runs every 15 mins which means by the end of the day there are almost 100 cmd boxes open.

Im basically looking for a way which either force closes the dialogue box (cmd) or simulates a spacebar press at the end of the batch file.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,587
Location:
Prague, Czechia

Re: How to force close cmd box on Win 10 after running script.

It seems that your batch file has a Windows pause command at the end. Like this:
winscp.com /script=importtracks.txt
pause
So it pauses at the end. If you do not want it to pause, remove the pause command.
Not a WinSCP issue.

Reply with quote

Advertisement

You can post new topics in this forum