本文介绍了pscp挂脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$ error.clear()

$ erroractionpreference ="SilentlyContinue"
$
echo"开始移动文件"

$ movefile = c:\ pscp.exe -pw **** $ oldfile [email protected]:/ file /
$
#Echo $ movefile

$ movefile

if(!$?)

{

$ Title ="错误移动文件的文件"

echo" admin," > $ textdoc

echo"无法将文件移动到destiation"
"
echo""无法将文件移动到destiation" >> $ textdoc

电子邮件

}

否则{

if(Test-Path $ textdoc){

  Remove-Item $ textdoc

  }
$ Title =" working"
$
echo" Admin," > $ textdoc

echo"请查找新文件" >> $ textdoc

删除项目$ oldfile

email}

$error.clear()
$erroractionpreference = "SilentlyContinue"
echo "starting to move the file"
$movefile = c:\pscp.exe -pw **** $oldfile [email protected]:/file/
# Echo $movefile
$movefile
if (!$?)
{
$Title ="Error Moving file for file"
echo "admin," > $textdoc
echo "Could not move file to destiation"
echo "Could not move file to destiation" >> $textdoc
email
}
Else {
if (Test-Path $textdoc){
  Remove-Item $textdoc
  }
$Title ="worked"
echo "Admin," > $textdoc
echo "Please look in for new file" >> $textdoc
Remove-Item $oldfile
email}

只要它的工作脚本运行正常。 但是说它无法连接它挂起脚本

as long as it work script run fine.  but say it can not connect it hangs the script

$ movefile = c:\ pscp.exe -pw **** $ oldfile [email protected]:/ file /

$movefile = c:\pscp.exe -pw **** $oldfile [email protected]:/file/

我想要做的是,如果文件无法向管理员发送电子邮件。

What i want to do is if the file can not move email the admin.

推荐答案


此变量与%ERRORLEVEL%

This variable is the same as %ERRORLEVEL%


这篇关于pscp挂脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 12:56