Does "/command" work from a command-prompt in Windows???

Advertisement

HelpMe!
Joined:
Posts:
3

Does "/command" work from a command-prompt in Windows???

OK, so I run the following from a command-prompt,

winscp3 scp://myusername:mypassword@myhostname/myremotepath /command "put c:\myfile.dat"

It connects to the "myhostname" just fine, but it doesn't copy the "myfile.dat" file to the host. I do not want to create a script for such a simple task. Any ideas why I can't get it to copy the file?

Thanks.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: Does "/command" work from a command-prompt in Windows???

What version of WinSCP are you using?
_________________
Martin Prikryl

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Can you post an output of the command on console?

Also,
would it work, if you use:
winscp3 scp://myusername:mypassword@myhostname/myremotepath /script=script.txt
and script.txt contains
put c:\myfile.dat
?

Reply with quote

HelpMe!
Joined:
Posts:
3

martin wrote:

Can you post an output of the command on console?

Also,
would it work, if you use:
winscp3 scp://myusername:mypassword@myhostname/myremotepath /script=script.txt
and script.txt contains
put c:\myfile.dat
?

Here's the output,

C:\Temp>winscp3.com scp://user1:password1@myhost.com/pub/data /command "put file1.txt"
Initialisation...
Searching for host...
Connecting to host...
Authenticating...
Using username "user1".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] user1@myhost.com
winscp>

It does work with if I create a "script.txt" file that contains put C:\file1.txt. However, I would prefer not to do that since I'm trying to run this command from within a PERL script.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Sorry, I've totally forgot that you cannot combine URL-like session parameter with the /command parameter. See documentation for more details. But you can do:
winscp3.com /command "open scp://user1:password1@myhost.com/pub/data" "put file1.txt"
_________________
Martin Prikryl

Reply with quote

Guest

martin wrote:

Sorry, I've totally forgot that you cannot combine URL-like session parameter with the /command parameter. See documentation for more details. But you can do:
winscp3.com /command "open scp://user1:password1@myhost.com/pub/data" "put file1.txt"

Thank you so much! Works flawlessly! I really appreciate all of your assistance!

Reply with quote

Advertisement

You can post new topics in this forum