windows 系统直接访问linux系统 的便捷方法
2014-12-30 15:16
579 查看
有很多博客介绍了: 如下
http://www.cnblogs.com/echo-something/archive/2012/09/20/pscp.html http://blog.csdn.net/zyz511919766/article/details/27546515
1. 用到一个公开的工具包 putty
2. 可以写一个 bat程序做一些批量操作和自动化操作
使用例子如下
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\putty D: pscp -pw 888888 root@192.1.51.195:/root/script/time_solidify.sh ./ updateDate.vbs pscp -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)¤tdate&" "&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 currentdate Function 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 Select End Function
相关文章推荐
- Windows系统下访问Linux的redis单机版及redis-cluster方法
- 双系统中从Windows访问Linux分区 ext2 ext3 的三种方法
- 在windows系统下直接将linux系统删除导致开机出现grub rescure而无法进入windows系统的修复方法
- 用Virtualbox 在linux和windows下 双系统互启 直接写物理硬盘 不使用硬盘镜像的方法
- 双系统中从Windows访问Linux分区 ext2 ext3 的三种方法
- Linux Windows 双系统下删除 Linux系统的方法
- 在Windows下删除Linux系统的方法
- Linux下访问Windows的方法(原)
- 在Windows下删除Linux系统的方法
- 在Windows下删除Linux系统的方法[转]
- Linux 系统中确保访问三级域名畅通的方法
- 更换默认启动系统的方法,适合于安装了windows 和 linux双系统的用户(转载)
- 修改grub引导的Linux和Windows双系统的启动顺序和删除Linux系统的方法
- 修改grub引导的Linux和Windows双系统的启动顺序和删除Linux系统的方法
- Windows 2000下对磁盘扇区数据的直接读写访问方法
- Linux访问Windows共享文件夹的方法
- Linux系统上使用smbclient访问Windows共享资源
- 苹果机 MacOSX Linux访问 Windows机器的方法
- Windows、Freebsd和Linux多重系统引导解决方法
- windows及Linux系统下获取IP及MAC地址的方法