Scripting ... problem with xp_cmdshell

Advertisement

Kathy
Guest

Scripting ... problem with xp_cmdshell

Using Winscp manually, it works great (recently installed Winscp 3.8.2).
However, we have a script that does some setup and then attempts to use winscp to sftp it to a defined server. I've tried both examples below (with both winscp3.exe and winscp3.com) and cannot get it to work. Any ideas?? Feel like I've tried everything. :?

TEST 1: ERRORS out with----'winscp3.exe' is not recognized as an internal or external command,operable program or batch file.

EXEC master..xp_cmdshell 'cd "c:\program files\winscp3"';
EXEC master..xp_cmdshell 'winscp3.exe /console /script="c:\temp\winscp.txt" WINSCPSession'

TEST 2: ERRORS out with -----'c:\program' is not recognized as an internal or external command, operable program or batch file.
EXEC master..xp_cmdshell '"c:\program files\winscp3\winscp3.exe /console /script="c:\temp\winscp.txt" WINSCPSession'

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Scripting ... problem with xp_cmdshell

I do not know syntax of xp_cmdshell. At least you can try to prevent using spaces in paths by using short path: c:\progra~1\winscp3\winscp3.exe

Reply with quote

Kathy
Guest

Re: Scripting ... problem with xp_cmdshell

martin wrote:

I do not know syntax of xp_cmdshell. At least you can try to prevent using spaces in paths by using short path: c:\progra~1\winscp3\winscp3.exe

I tried the short path, but I get the same error.
I also tried to set up a Scheduled Task to do this, thinking that would be a good workaround, but that does not error out, but nothing happens. In properties of the scheduled task I have: "C:\Progra~1\WinSCP3\WinSCP3.com" /console /script=C:\temp\winscp.txt

If I can't get this to work with xp_cmdshell, how to get the scheduled task to work?

Reply with quote

martin
Site Admin
martin avatar

Re: Scripting ... problem with xp_cmdshell

Kathy wrote:

If I can't get this to work with xp_cmdshell, how to get the scheduled task to work?
Please read FAQ first.

Reply with quote

Advertisement

You can post new topics in this forum