Topic "Best procedure to run a command line script."

Author Message
tommytx

Guest


Please help me out here as I am completely lost. I want to run a command line script and not sure where on the hard drive to put the script.. I made a batch file and an example script and tried that but no workee.. Do I have to find the same directory that winscp.exe is located to place my bat file and example file..
I looked for the c:/Program Files/WinScp/winscp.exe but could not find anything like that on my hard drive.
I do have winscp installed and can use the interface easily and it works well.


Code inside example.txt
Code:

winscp.com /ini=nul /command ^
    "open sftp://user:password@example.com/ -hostkey=""ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx""" ^
    "get examplefile.txt d:\" ^
    "exit"


Code inside my batch file.
Code:

winscp.com /ini=nul /script=example.txt
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26331
Location: Prague, Czechia
This is not a WinSCP script, its a complete batch file:
Code:

winscp.com /ini=nul /command ^
    "open sftp://user:password@example.com/ -hostkey=""ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx""" ^
    "get examplefile.txt d:\" ^
    "exit"


So store the above lines to the batch file. You do not need any example.txt.
Guest




Thanks for the extra info but they question was how and where do I run it. must it be in the Winscp directory with the winscp.exe or the .com.. I assume to run a script i would use the .com..
Guest




Like for example i get into this directory:

C:\Program Files (x86) \WinScp>

and try something like this.. "Open sftp://user:pass@vahud.com"
and nothing happens.. about the only thing I can get to run is simple old dos commands like cd and dir..
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26331
Location: Prague, Czechia
Again, store the lines from my post to a batch file (e.g. upload.bat). And run the batch file.

Ideally use absolute paths in the batch file (both to the winscp.com and the source local file). Then it would not matter, what directory you store the batch file to.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License