Post a reply

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)


Topic review


I looks rather like a local problem, not with SFTP.

Can it be something with sftp? Because it's sftp in the script file.
I thought maybe when it runs as a service in another user with ini file, maybe there is any problem with getting to some files through sftp...
What do you think?

OK, I'm not sure how to help you and it definitely does not seem to be related to WinSCP itself.

Thank you reply. Here is the description of the error in Event Logger:

The instance's SvcRun() method failed
Traceback (most recent call last):
File "C:\Python33\lib\site-packages\win32\lib\", line 835, in SvcRun
File "C:\Rimma\ArcSight\", line 59, in SvcDoRun
retval = subprocess.check_output(['"C:\Program Files (x86)\" /script="C:\Rimma\ArcSight\winscp_script.txt"'])
File "C:\Python33\lib\", line 576, in check_output
with Popen(*popenargs, stdout=PIPE, **kwargs) as process:
File "C:\Python33\lib\", line 824, in __init__
restore_signals, start_new_session)
File "C:\Python33\lib\", line 1118, in _execute_child
raise WindowsError(*e.args)
PermissionError: [WinError 5] Access is denied
%2: %3

What happens when you run directly, instead of through .bat file?

Sure, you are right , twice :).
1) It should be fff.txt.
2) Now it makes sense, but there is the same error.
3) In the Scheduler - I should wait for 10 seconds, for example... interesting idea, thanks!
4) Anyway, in Python, when I can run[...bat]) it just does nothing.
When I run retVal = subprocess.check_output([...bat]) I get the error I put to you.
I write on one computer, but run in on another (with connection to linux vm)

Here is the output in Event Viewer, after I start the service in Services:

The instance's SvcRun() method failed
Traceback (most recent call last):
File "C:\Python33\lib\site-packages\win32\lib\", line 835, in SvcRun
File "C:\Rimma\AS\", line 58, in SvcDoRun
retval = subprocess.check_output(['C:/Rimma/AS/winscp_srv.bat'])
File "C:\Python33\lib\", line 589, in check_output
raise CalledProcessError(retcode, process.args, output=output)
subprocess.CalledProcessError: Command '['C:/Rimma/AS/winscp_srv.bat']' returned non-zero exit status 3221225794
%2: %3

Thank you in advance!

Re: WinScp as a Windows service

rimma wrote: /ini=c:/ddd/winscp.ini /log=c:/ddd/winscp.log /script=fff/txt

This does not make sense.

The first line would hang the batch, waiting for input.
You should do: /script=fff/txt /ini=c:/ddd/winscp.ini /log=c:/ddd/winscp.log

(btw, shouldn't it be fff.txt?)

Anyway, please post an output of the batch (when ran from Python).

Or what about running a batch from Scheduler every minute that loops 6 times?

WinScp as a Windows service

I have a small script:

option batch abort
option confirm off
open sftp://user@esm
get -delete /opt/cccc/*.txt c:\bbb\*.txt

And a batch file: /ini=c:/ddd/winscp.ini /log=c:/ddd/winscp.log /script=fff/txt

When I run it from console or double click on the batch, it works well. But I need to run it as a service (each 10 secs), so I can't use Scheduler (minimum is 1 min)

I wrote a small program on Python that runs this batch, just run it. Anything works there, except for this batch!
Also, when I check the output of running this batch, it returns 3221225794 error status code, that actually means "access denied". But I put ini file, instead of using registry.

Can anyone help me?
Thank you in advace!