Autoit脚本调用pscp上传小程序
linux上传文件用pscp上传相对麻烦,如下写了个脚本方便上传
代码如下:
$fileURL=@ScriptDir & "pscp.ini" If (FileExists($fileURL)==0)Then IniWrite($fileURL,"Sever","IP","192.168.1.1") IniWrite($fileURL,"Sever","user","root") IniWrite($fileURL,"Sever","password","") IniWrite($fileURL,"Sever","DesFolder","/home") EndIf $desvalue=IniRead($fileURL,"Sever","DesFolder","/home") $IPvalue=IniRead($fileURL,"Sever","IP","192.168.1.1") $uservalue=IniRead($fileURL,"Sever","user","root") $passwordvalue=IniRead($fileURL,"Sever","password","123") $newdesvalue=InputBox("服务器:"&$IPvalue,"请输入要上传到服务器的目录",$desvalue) IniWrite($fileURL,"Sever","DesFolder",$newdesvalue) $var = FileOpenDialog("选择文件.", @DesktopDir & "\", "所有文件(*.*)", 1) If @error Then MsgBox(4096,"","没有选择文件!") Else If (MsgBox(1,"上传文件","你是否要上传:" & $var)==1)Then MsgBox(4096,"",$var) Run(@ScriptDir&"\pscp -l "&$uservalue&" -pw "&$passwordvalue&" -p 22 "&$var&" "&$IPvalue&":"&$newdesvalue) EndIf EndIf