Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

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.
ukdeveloper

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.
martin

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

WinSCP does not display such prompt.
How are you running WinSCP from the Task Scheduler?
See also https://winscp.net/eng/docs/guide_schedule
ukdeveloper

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.