欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來(lái)到入門(mén)教程網(wǎng)!

vb

當(dāng)前位置:主頁(yè) > 軟件編程 > vb >

利用vbscript腳本修改文件內(nèi)容,此適用于自動(dòng)化的操作中

來(lái)源:本站原創(chuàng)|時(shí)間:2020-01-10|欄目:vb|點(diǎn)擊: 次

利用vbscript腳本修改文件內(nèi)容,此適用于自動(dòng)化的操作中

'新建一個(gè)Replace.vbs腳本,腳本內(nèi)容如下,程序運(yùn)行時(shí)輸入三個(gè)參數(shù):查找內(nèi)容,替換內(nèi)容,文件 

復(fù)制代碼 代碼如下:
Dim FileName, Find, ReplaceWith, FileContents, dFileContents  
Find = WScript.Arguments(0)  
ReplaceWith = WScript.Arguments(1)  
FileName = WScript.Arguments(2)  

'讀取文件  
FileContents = GetFile(FileName)  

'用“替換內(nèi)容”替換文件中所有“查找內(nèi)容”  
dFileContents = replace(FileContents, Find, ReplaceWith, 1, -1, 1)  

'比較源文件和替換后的文件  
if dFileContents <> FileContents Then  
'保存替換后的文件  
WriteFile FileName, dFileContents  

Wscript.Echo "Replace done."  
If Len(ReplaceWith) <> Len(Find) Then  
'計(jì)算替換總數(shù)  
Wscript.Echo _  
( (Len(dFileContents) - Len(FileContents)) / (Len(ReplaceWith)-Len(Find)) ) & _  
" replacements."  
End If  
Else  
Wscript.Echo "Searched string Not In the source file"  
End If  

'讀取文件  
function GetFile(FileName)  
If FileName<>"" Then  
Dim FS, FileStream  
Set FS = CreateObject("Scripting.FileSystemObject")  
on error resume Next  
Set FileStream = FS.OpenTextFile(FileName)  
GetFile = FileStream.ReadAll  
End If  
End Function  

'寫(xiě)文件  
function WriteFile(FileName, Contents)  
Dim OutStream, FS  

on error resume Next  
Set FS = CreateObject("Scripting.FileSystemObject")  
Set OutStream = FS.OpenTextFile(FileName, 2, True)  
OutStream.Write Contents  
End Function

上一篇:vbs/js腳本編程教學(xué)(2)

欄    目:vb

下一篇:VBS教程:函數(shù)-Array 函數(shù)

本文標(biāo)題:利用vbscript腳本修改文件內(nèi)容,此適用于自動(dòng)化的操作中

本文地址:http://mengdiqiu.com.cn/a1/vb/8029.html

網(wǎng)頁(yè)制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語(yǔ)言數(shù)據(jù)庫(kù)服務(wù)器

如果侵犯了您的權(quán)利,請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有