Announcement

Collapse
No announcement yet.

WinSCP via Windows Command Line Interface

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • WinSCP via Windows Command Line Interface

    Hello all. I am new to Comodo and new to the Python programming language, so try not to beat on me too much.

    I have a Windows 7 computer with WinSCP installed. I am trying to FTP a zip file to my cloud server via a Comodo Procedure. I can carry it out successfully via the Windows CLI, but when I run it in Comodo, the zip file does not copy.

    Anyone have insights on what I'm doing wrong here?

    cmd='cd "C:\Program Files (x86)\WinSCP"'
    cmd='winscp.com /command "option batch abort" "option confirm off" "open ftp://usernameassword@hostname.com:21"'
    cmd='cd incoming'
    cmd='cd MBAM_Logs'
    cmd='lcd C:\ProgramData\Malwarebytes\MBAMService\ScanResult s'
    cmd='put *.zip'
    cmd='exit'
    import os;
    import ctypes
    class disable_file_system_redirection:
    _disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirect ion
    _revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirecti on
    def __enter__(self):
    self.old_value = ctypes.c_long()
    self.success = self._disable(ctypes.byref(self.old_value))
    def __exit__(self, type, value, traceback):
    if self.success:
    self._revert(self.old_value)
    with disable_file_system_redirection():
    out=os.popen(cmd).read();
    print(out);

  • #2
    Hello superiortechnologyservices,

    Thank you for bringing this issue to our attention. We will communicate with you shortly via email for the process in resolving this case.

    Comment


    • #3
      Hello superiortechnologyservices,

      Defining a same variable i.e(cmd) multiples times will consider the last updated string which defined to the last variable. In your script the last cmd="exit" , while executing it considers only "exit" as a command.The preferable way of executing these winscp commands is storing those commands as a text file and then executing it. Please refer to the created script below and please let us know your feedback.

      https://scripts.comodo.com/frontend/...s-using-winscp

      Thank you,

      Comment


      • #4
        This helped resolve the issue I was dealing with. Can't thank you enough!

        Comment

        Working...
        X