问题在执行中的WinSCP批处理文件 [英] Problem in executing the batch file in winscp

查看:421
本文介绍了问题在执行中的WinSCP批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的WinSCP,我在执行批处理文件有问题。

I am new to Winscp and I am having a problem in executing a batch file.

该方案是这样的:

我有一个批处理文件,两个文件夹(最多B和向下文件夹C),在长达文件夹D,一个文本文件E(从D中的文件不同的)一些文本文件和文件PPK F.所有这些事情在只有一个文件夹。

I have a batch file A, two folders (up B and down folders C), some text files in up folder D, a text file E (different from the files in D) and a ppk file F. All these things are in one folder only.

该批处理文件是有一个脚本(脚本如下图所示),其中包含文本。如果该文本内容是真实的(也就是说,如果该文本(文本内容相关到E即,如果在执行文本文件E)的执行),则仅在向上文件夹B的文件移动到向下夹C.

The batch file A is having a script (script is shown below) which contains text. If that text contents are true (means if that text (text contents are related to E i.e. if the text file E is executed) is executed) then only the files in up folder B moves to down folder C.

和批处理文件中的脚本是:

And the script in batch file A is:

C:\somefolder\WinSCP3.exe /console /script=E.txt /log=session.log
if errorlevel 1 goto error
xcopy C:\somefolder\up\*.*  C:\somefolder\down\  /y
del  C:\somefolder\up\*.*   /Q
:error
echo Upload failed, keeping local files

和文本文件E中的内容是:

And the content in text file E is:

option batch abort
option confirm off
open @test.com 
change remote directory
cd \somedirectory
option transfer binary
put C:\somefolder\up\*.*
close
exit

我不知道为什么,从上文件夹中的文件没有移动到文件夹下。

I don't know why the files from up folder is not moving to down folder.

请让我知道确切的问题是,如何解决这一问题....

Please let me know where exactly the problem is and how to resolve that problem....

推荐答案

感谢舍甫琴科M.他的评论清除我的困惑,并给出了正确的答案。

Thanks to Andriy M. His comments cleared my confusion and gave the right answer.

下面是正确的语法。

C:\somefolder\WinSCP3.exe /console /script=E.txt /log=session.log

xcopy C:\somefolder\up\*.*  C:\somefolder\down\  /y
del  C:\somefolder\up\*.*   /Q

if errorlevel 1 goto error

:error
echo Upload failed, keeping local files

在文本文件中E.txt的内容是:

The content in text file E.txt is:

option batch abort
option confirm off
open @test.com 
change remote directory
cd \somedirectory
option transfer binary
put C:\somefolder\up\*.*
close
exit

这篇关于问题在执行中的WinSCP批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆