windows 系統直接存取linux系統 的便捷方法

來源:互聯網
上載者:User

標籤:

有很多部落格介紹了: 如下

http://www.cnblogs.com/echo-something/archive/2012/09/20/pscp.html

http://blog.csdn.net/zyz511919766/article/details/27546515

 

1. 用到一個公開的工具包  putty 

2. 可以寫一個 bat程式做一些大量操作和自動化操作

使用例子如下

cd D:\tools\puttyD:pscp -pw 888888 [email protected]:/root/script/time_solidify.sh ./updateDate.vbspscp -l root -pw 888888 ./time_solidify.sh 192.1.51.195:/root/script/time_solidify.sh
‘  讀指定的檔案         Dim  pathway         Dim fso,myfile,newfile,i,flag,currentdate         pathway = "D:\tools\putty\time_solidify.sh"         new_pathway = "D:\tools\putty\new_time_solidify.sh"         flag = 1   Set fso = CreateObject ("Scripting.FileSystemObject")   If fso.FileExists (pathway) Then            Set myfile = fso.OpenTextFile (pathway,1,false)            If fso.FileExists (new_pathway) Then                      ‘ 清空                             fso.DeleteFile (new_pathway)            end if            Set newfile = fso.CreateTextFile (new_pathway,false)   else                   flag = 0         End If         Set regEx = New RegExp         regEx.Pattern = ".*\d{4}-\d{2}-\d{2}.*"    If flag=1 Then                   do                            txt = myfile.ReadLine()                            If regEx.Test(txt) Then                                     ‘ 取得日期                                     vartxt = txt                                     currentdate = mid(txt,instr(txt,chr(34))+1,10)                                     currentdate = DateAdd("d",1,currentdate)                                     currentdate = format_time(currentdate,2)                                     temptxt = "date -s "&chr(34)&currentdate&" "&chr(34)&"${now_time}"                                     ‘ 修改後的日期進行添加新的檔案當中                                     newfile.WriteLine(temptxt)                                     else                                     ‘  新增內容                                     newfile.WriteLine(txt)                            End If                   loop while (not myfile.AtEndOfStream)         End If         ‘  舊的檔案刪掉         ‘fso.DeleteFile(pathway)         ‘  新的檔案更名         fso.CopyFile new_pathway,pathway         ‘fso.DeleteFile(new_pathway)         Set myfile = nothing         Set newfile = nothing         Set fso = nothing         Set regEx = nothing‘currentdate = DateAdd("d",1,"2014-10-31")‘msgbox currentdateFunction Format_Time(s_Time, n_Flag)         Dim y, m, d, h, mi, s         Format_Time = ""         If IsDate(s_Time) = False Then Exit Function         y = cstr(year(s_Time))         m = cstr(month(s_Time))         If len(m) = 1 Then m = "0" & m         d = cstr(day(s_Time))         If len(d) = 1 Then d = "0" & d         h = cstr(hour(s_Time))         If len(h) = 1 Then h = "0" & h         mi = cstr(minute(s_Time))         If len(mi) = 1 Then mi = "0" & mi         s = cstr(second(s_Time))         If len(s) = 1 Then s = "0" & s         Select Case n_Flag         Case 1         ‘ yyyy-mm-dd hh:mm:ss         Format_Time = y  & m & d         Case 2         ‘ yyyy-mm-dd         Format_Time = y & "-" & m & "-" & d         Case 3         ‘ hh:mm:ss         Format_Time = h & ":" & mi & ":" & s         Case 4         ‘ yyyy年mm月dd日         Format_Time = y & "年" & m & "月" & d & "日"         Case 5         ‘ yyyymmdd         Format_Time = y & m & d         End SelectEnd Function

 

windows 系統直接存取linux系統 的便捷方法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.