Command-line Windows SFTP server

Advertisement

hendra
Joined:
Posts:
3

Command-line Windows SFTP server

help, is winscp support access windows sftp server.
can i use windows command to run
session.executecommand
??
such as cmd /c start, chkdsk, schtasks /create.
thanks

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
33,516
Location:
Prague, Czechia

Re: Command-line Windows SFTP server

Yes, Windows SFTP/SSH server is SFTP/SSH server as any other.

Reply with quote

hendra
Joined:
Posts:
3

Re: Command-line Windows SFTP server

martin wrote:

Yes, Windows SFTP/SSH server is SFTP/SSH server as any other.

when i execute this string:
session.ExecuteCommand("cmd /c start calc.exe").Check()

it took a long time,even though the result is an error :
Connection has been unexpectedly closed. Server sent command exit status 0.

in log it write :
< 2020-05-04 10:23:10.836 [Shell] 

it look like the command is not recognized.
Description: log winscp

Reply with quote

martin
Site Admin
martin avatar

Re: Command-line Windows SFTP server

It makes no sense to execute a GUI application in an SSH session. What do you expect it to do? Did you think it will open the GUI application in the interactive Windows session? It cannot. The SSH and interactive sessions are isolated.

Reply with quote

hendra
Joined:
Posts:
3

Re: Command-line Windows SFTP server

martin wrote:

It makes no sense to execute a GUI application in an SSH session. What do you expect it to do? Did you think it will open the GUI application in the interactive Windows session? It cannot. The SSH and interactive sessions are isolated.

what if i start application like schtasks, that not interactive/GUI application. its like sqldump isn't it??

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: Command-line Windows SFTP server

Yes schtasks should work. But WinSCP Session.ExecuteCommand needs Linux shell. It won't work with Windows shell and Windows command. WinSCP is primarily an SFTP client. It's not the right tool to execute commands on SSH server.

Reply with quote

Advertisement

You can post new topics in this forum