フォルダの中に
*******************
a.vbs
01/01.html
02/02.html
‥/‥.html
99/99.html
*******************
が入っています
htmlの中には必ず以下の行が入っています
************************************
<meta http-equiv="Content-Type" content="text/html;>
************************************
a.vbsを実行したらファイル内すべての上記1文を以下の文に置換して欲しいのですが
************************************
<meta http-equiv="Content-Type" content="text/html" name="robots" content="noindex,nofollow">
************************************
どのようなプログラムを組めばいいでしょうか?
よろしくお願いします
こういう事でしょうか。
Option Explicit Const sText = "<meta http-equiv=""Content-Type"" content=""text/html;>" Const rText = "<meta http-equiv=""Content-Type"" content=""text/html"" name=""robots"" content=""noindex,nofollow""> " Dim fso Set fso = CreateObject("Scripting.FileSystemObject") Dim htmlFile Dim htmlText Dim folder For Each folder In fso.GetFile(WScript.ScriptFullName).ParentFolder.SubFolders For Each htmlFile In folder.Files If fso.GetExtensionName( htmlFile.Name ) = "html" Then htmlText = fso.OpenTextFile( htmlFile.Path ).ReadAll() fso.CreateTextFile(htmlFile.Path,True).Write Replace(htmlText,sText,rText) End If Next Next
動きました!
2014/02/12 02:38:37本当にありがとうございました!!