0

So my current idea is to use the winscp tool on a remote windows machine to get file from other machine.

My current idea is to create subprocess on the remote windows machine and run the Winscp tool Command Line options given in their website.

 process = subprocess.Popen(
     [new_winscp_dir, '/ini=nul', '/command',
     'open -hostkey=acceptnew -password='+password+' sftp://'+username+'@'+hostname, 
     get '+newPath, 'exit'],
     stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 for line in iter(process.stdout.readline, b''):  
     print(line.decode().rstrip())

my problem right now is, how can I open a connection to the remote machine and run this script onto that machine. Is it possible to just run a subprocess that open a connection to the remote machine and continue the subprocess to run another process along?

I searched for other idea such as using paramiko but correct me if i am wrong, that paramiko only available when the package is installed on the machine which a bit problem for windows machine.

Or is there other simple python script that allow to open a connection to remote machine, locally and then run and pass the command locally to that machine.

  • @MartinPrikryl cool. i think i kinda got it now. so i might need to scratch the current idea and try with cmd method instead. will try that one out. – Zahier Arbaai Oct 18 '22 at 15:59

0 Answers0