﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Vi`blog · 唯音 &#187; 批处理</title>
	<atom:link href="http://www.viyin.net/tag/%e6%89%b9%e5%a4%84%e7%90%86/feed" rel="self" type="application/rss+xml" />
	<link>http://www.viyin.net</link>
	<description>岂能尽如人意，但求无愧于心</description>
	<lastBuildDate>Mon, 14 Nov 2011 15:43:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>vbs对比更新删除</title>
		<link>http://www.viyin.net/2010/07/vbs%e5%af%b9%e6%af%94%e6%9b%b4%e6%96%b0%e5%88%a0%e9%99%a4.html</link>
		<comments>http://www.viyin.net/2010/07/vbs%e5%af%b9%e6%af%94%e6%9b%b4%e6%96%b0%e5%88%a0%e9%99%a4.html#comments</comments>
		<pubDate>Sat, 03 Jul 2010 03:14:45 +0000</pubDate>
		<dc:creator>vi</dc:creator>
				<category><![CDATA[√文章精选]]></category>
		<category><![CDATA[bat]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[对比删除]]></category>
		<category><![CDATA[对比更新]]></category>
		<category><![CDATA[批处理]]></category>

		<guid isPermaLink="false">http://www.viyin.net/?p=890</guid>
		<description><![CDATA[整理的是相当的痛苦。。。 更改这三条 echo copyfol “D:\dnf”,”D:\b” >> c:\diff.vbs echo sdir=”d:\dnf” >> c:\diff.vbs echo ddir=”d:\b” >> c:\diff.vbs 更改其中的这三条语句。 d:\dnf 为源目录。 d:\b 目的目录（需要更新还原的目录）。 @echo off del /f /q&#160; c:\diff.vbs echo Option Explicit &#62;&#62; c:\diff.vbs &#160; echo sub copyfol(sDir,Ddir) &#62;&#62; c:\diff.vbs &#160; echo&#160; &#160;dim fso,fol,fs,f1, objfile &#62;&#62; c:\diff.vbs echo&#160; &#160;dim arrFiles(),arrSize(),arrModified() &#62;&#62; c:\diff.vbs echo&#160; &#160;dim i &#62;&#62;c:\diff.vbs echo&#160; &#160;if [...]]]></description>
			<content:encoded><![CDATA[<p>整理的是相当的痛苦。。。<br />
更改这三条<br />
echo copyfol “D:\<a href="http://www.viyin.net/tag/dnf" class="st_tag internal_tag" rel="tag" title="标签 dnf 下的日志">dnf</a>”,”D:\b”  >> c:\diff.<a href="http://www.viyin.net/tag/vbs" class="st_tag internal_tag" rel="tag" title="标签 vbs 下的日志">vbs</a><br />
echo sdir=”d:\dnf”  >> c:\diff.vbs<br />
echo ddir=”d:\b”  >> c:\diff.vbs</p>
<p>更改其中的这三条语句。<br />
d:\dnf 为源目录。  d:\b 目的目录（需要更新还原的目录）。</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">@echo off</li>
<li>del /f /q&nbsp; c:\diff.vbs</li>
<li>echo Option Explicit &gt;&gt; c:\diff.vbs</li>
<li>&nbsp;</li>
<li>echo sub copyfol(sDir,Ddir) &gt;&gt; c:\diff.vbs</li>
<li>&nbsp;</li>
<li>echo&nbsp; &nbsp;dim fso,fol,fs,f1, objfile &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;dim arrFiles(),arrSize(),arrModified() &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;dim i &gt;&gt;c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;if right(ddir,1)^&lt;^&gt;&quot;\&quot; then ddir =ddir ^&amp; &quot;\&quot; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;if right(sdir,1)^&lt;^&gt;&quot;\&quot; then sdir =sdir ^&amp; &quot;\&quot; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;) &gt;&gt; c:\diff.vbs</li>
<li>&nbsp;</li>
<li>echo&nbsp; &nbsp;if not (fso.FolderExists(sdir))&nbsp; then &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp;msgbox &quot;找不到文件夹：&quot; ^&amp; sdir &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp;exit sub &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;end if &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;if not (fso.FolderExists(ddir))&nbsp; then &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; msgbox &quot;找不到文件夹：&quot; ^&amp; sdir &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; exit sub &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;end if &gt;&gt; c:\diff.vbs</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>echo&nbsp; &nbsp;set fol=fso.GetFolder(ddir) &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;set fs=fol.files &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;i=0 &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;redim arrFiles(fs.count-1) &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;redim arrSize(fs.count-1) &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;redim arrModified(fs.count-1) &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;for each f1 in fs &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; arrfiles(i)=f1.name &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; arrSize(i)=f1.size &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; arrModified(i)=f1.DateLastModified &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; i=i+1 &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;next &gt;&gt; c:\diff.vbs</li>
<li>&nbsp;</li>
<li>echo&nbsp; &nbsp;set fol=fso.GetFolder(sdir) &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;set fs=fol.files &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;for i = 0 to ubound(arrfiles) &gt;&gt; c:\diff.vbs</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp;dim delfile&nbsp; &nbsp;&gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp;delfile=false &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp;for each f1 in fs &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if strcomp(arrfiles(i),f1.name,vbTextCompare)=0 then&nbsp; &nbsp; &nbsp;&gt;&gt; c:\diff.vbs&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if arrsize(i)^&lt;^&gt; f1.size or arrModified(i)^&lt;^&gt;f1.DateLastModified then &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fso.copyfile f1.path, ddir ^&amp; arrfiles(i),true&nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end if &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delfile=true '如果文件存在 &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exit for &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end if &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; next &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; if not delfile then&nbsp; &nbsp; &nbsp; &gt;&gt; c:\diff.vbs&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set objfile=fso.getfile(ddir ^&amp;arrfiles(i)) &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; objfile.Delete (true) &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end if&nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt; c:\diff.vbs&nbsp; &nbsp; </li>
<li>echo&nbsp; &nbsp; next &gt;&gt; c:\diff.vbs</li>
<li>&nbsp;</li>
<li>echo&nbsp; &nbsp;for each f1 in fs &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp;delfile=false &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp;for i=0 to ubound(arrfiles) &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if strcomp(f1.name,arrfiles(i),vbtextcompare)=0 then &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;delfile=true &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exit for &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end if &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; next&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if right (ddir,1)^&lt;^&gt;&quot;\&quot; then ddir=ddir ^&amp;&quot;\&quot; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; if not delfile then&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; c:\diff.vbs </li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;f1.copy ddir,true &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; end if &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;next &gt;&gt; c:\diff.vbs</li>
<li>&nbsp;</li>
<li>echo&nbsp; &nbsp;dim fols &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;set fol=Fso.GetFolder(sdir) &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;set fols=fol.SubFolders &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;for each f1 in fols &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; if not (fso.FolderExists(ddir ^&amp; f1.name)) then&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fso.CreateFolder(ddir ^&amp; f1.name) &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; end if &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; copyfol sdir ^&amp; f1.name ,ddir ^&amp; f1.name &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;next &gt;&gt; c:\diff.vbs</li>
<li>echo end sub &gt;&gt; c:\diff.vbs</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>echo copyfol &quot;D:\dnf&quot;,&quot;D:\b&quot;&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>&nbsp;</li>
<li>echo dim sdir,ddir&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo '源目录&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo sdir=&quot;d:\dnf&quot;&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo '目的目录&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo ddir=&quot;d:\b&quot;&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo function comparefile(sdir,ddir)&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;dim Fso,dFol,dfs,sf1,f1&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;set Fso=CreateObject(&quot;Scripting.FileSystemObject&quot;)&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;if not(Fso.folderexists(sdir)) then&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp;msgbox chr(34) ^&amp;sdir ^&amp;chr(34) ^&amp;&quot;文件夹不存在，请确认！&quot;,64&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp;exit function&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;end if&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;if not(Fso.folderexists(ddir)) then&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp;msgbox chr(34) ^&amp;ddir ^&amp;&quot;&quot;&quot;文件夹不存在，请确认！&quot;,64&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp;exit function&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;end if&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;if right(sdir,1)^&lt;^&gt;&quot;\&quot; then sdir=sdir ^&amp;&quot;\&quot;&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;set dFol=fso.getfolder(ddir)&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;set dfs=dfol.files&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;for each f1 in dfs&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp;if fso.fileexists(sdir ^&amp; f1.name)&nbsp; then&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;set sf1=fso.GetFile(sdir ^&amp; f1.name)&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if f1.DateLastModified ^&lt;^&gt;sf1.DateLastModified or f1.size^&lt;^&gt;sf1.size then &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;f1.delete&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end if&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;f1.Delete(true)&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end if&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp;next&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;dim fols&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;set fols=dfol.subfolders&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;for each f1 in fols&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp;if not fso.folderexists(sdir ^&amp;f1.name) then&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;f1.delete true&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp;else&nbsp; &nbsp; &nbsp;&gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;comparefile sdir ^&amp; f1.name,f1.path&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp; &nbsp; &nbsp;end if&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo&nbsp; &nbsp;next&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo end function&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>echo comparefile sdir,ddir&nbsp; &gt;&gt; c:\diff.vbs</li>
<li>&nbsp;</li>
<li>start c:\diff.vbs</li></ol></div>
<p>@echo off<br />
del /f /q  c:\diff.vbs<br />
echo Option Explicit >> c:\diff.vbs</p>
<p>echo sub copyfol(sDir,Ddir) >> c:\diff.vbs</p>
<p>echo   dim fso,fol,fs,f1, objfile >> c:\diff.vbs<br />
echo   dim arrFiles(),arrSize(),arrModified() >> c:\diff.vbs<br />
echo   dim i >>c:\diff.vbs<br />
echo   if right(ddir,1)^<^>“\” then ddir =ddir ^&#038; “\” >> c:\diff.vbs<br />
echo   if right(sdir,1)^<^>“\” then sdir =sdir ^&#038; “\” >> c:\diff.vbs<br />
echo   Set fso = CreateObject(“Scripting.FileSystemObject”) >> c:\diff.vbs</p>
<p>echo   if not (fso.FolderExists(sdir))  then >> c:\diff.vbs<br />
echo       msgbox “找不到文件夹：” ^&#038; sdir >> c:\diff.vbs<br />
echo       exit sub >> c:\diff.vbs<br />
echo   end if >> c:\diff.vbs<br />
echo   if not (fso.FolderExists(ddir))  then >> c:\diff.vbs<br />
echo        msgbox “找不到文件夹：” ^&#038; sdir >> c:\diff.vbs<br />
echo        exit sub >> c:\diff.vbs<br />
echo   end if >> c:\diff.vbs</p>
<p>echo   set fol=fso.GetFolder(ddir) >> c:\diff.vbs<br />
echo   set fs=fol.files >> c:\diff.vbs<br />
echo   i=0 >> c:\diff.vbs<br />
echo   redim arrFiles(fs.count-1) >> c:\diff.vbs<br />
echo   redim arrSize(fs.count-1) >> c:\diff.vbs<br />
echo   redim arrModified(fs.count-1) >> c:\diff.vbs<br />
echo   for each f1 in fs >> c:\diff.vbs<br />
echo      arrfiles(i)=f1.name >> c:\diff.vbs<br />
echo      arrSize(i)=f1.size >> c:\diff.vbs<br />
echo      arrModified(i)=f1.DateLastModified >> c:\diff.vbs<br />
echo      i=i+1 >> c:\diff.vbs<br />
echo   next >> c:\diff.vbs</p>
<p>echo   set fol=fso.GetFolder(sdir) >> c:\diff.vbs<br />
echo   set fs=fol.files >> c:\diff.vbs<br />
echo   for i = 0 to ubound(arrfiles) >> c:\diff.vbs</p>
<p>echo       dim delfile   >> c:\diff.vbs<br />
echo       delfile=false >> c:\diff.vbs<br />
echo       for each f1 in fs >> c:\diff.vbs<br />
echo           if strcomp(arrfiles(i),f1.name,vbTextCompare)=0 then     >> c:\diff.vbs<br />
echo               if arrsize(i)^<^> f1.size or arrModified(i)^<^>f1.DateLastModified then >> c:\diff.vbs<br />
echo                  fso.copyfile f1.path, ddir ^&#038; arrfiles(i),true        >> c:\diff.vbs<br />
echo               end if >> c:\diff.vbs<br />
echo              delfile=true &#8216;如果文件存在 >> c:\diff.vbs<br />
echo               exit for >> c:\diff.vbs<br />
echo            end if >> c:\diff.vbs<br />
echo        next >> c:\diff.vbs<br />
echo        if not delfile then      >> c:\diff.vbs<br />
echo            set objfile=fso.getfile(ddir ^&#038;arrfiles(i)) >> c:\diff.vbs<br />
echo            objfile.Delete (true) >> c:\diff.vbs<br />
echo         end if       >> c:\diff.vbs<br />
echo    next >> c:\diff.vbs</p>
<p>echo   for each f1 in fs >> c:\diff.vbs<br />
echo       delfile=false >> c:\diff.vbs<br />
echo       for i=0 to ubound(arrfiles) >> c:\diff.vbs<br />
echo          if strcomp(f1.name,arrfiles(i),vbtextcompare)=0 then >> c:\diff.vbs<br />
echo             delfile=true >> c:\diff.vbs<br />
echo             exit for >> c:\diff.vbs<br />
echo          end if >> c:\diff.vbs<br />
echo        next  >> c:\diff.vbs<br />
echo         if right (ddir,1)^<^>“\” then ddir=ddir ^&#038;”\” >> c:\diff.vbs<br />
echo        if not delfile then          >> c:\diff.vbs<br />
echo           f1.copy ddir,true >> c:\diff.vbs<br />
echo        end if >> c:\diff.vbs<br />
echo   next >> c:\diff.vbs</p>
<p>echo   dim fols >> c:\diff.vbs<br />
echo   set fol=Fso.GetFolder(sdir) >> c:\diff.vbs<br />
echo   set fols=fol.SubFolders >> c:\diff.vbs<br />
echo   for each f1 in fols >> c:\diff.vbs<br />
echo      if not (fso.FolderExists(ddir ^&#038; f1.name)) then  >> c:\diff.vbs<br />
echo         fso.CreateFolder(ddir ^&#038; f1.name) >> c:\diff.vbs<br />
echo      end if >> c:\diff.vbs<br />
echo      copyfol sdir ^&#038; f1.name ,ddir ^&#038; f1.name >> c:\diff.vbs<br />
echo   next >> c:\diff.vbs<br />
echo end sub >> c:\diff.vbs</p>
<p>echo copyfol “D:\dnf”,”D:\b”  >> c:\diff.vbs</p>
<p>echo dim sdir,ddir  >> c:\diff.vbs<br />
echo &#8216;源目录  >> c:\diff.vbs<br />
echo sdir=”d:\dnf”  >> c:\diff.vbs<br />
echo &#8216;目的目录  >> c:\diff.vbs<br />
echo ddir=”d:\b”  >> c:\diff.vbs<br />
echo function comparefile(sdir,ddir)  >> c:\diff.vbs<br />
echo   dim Fso,dFol,dfs,sf1,f1  >> c:\diff.vbs<br />
echo   set Fso=CreateObject(“Scripting.FileSystemObject”)  >> c:\diff.vbs<br />
echo   if not(Fso.folderexists(sdir)) then  >> c:\diff.vbs<br />
echo       msgbox chr(34) ^&#038;sdir ^&#038;chr(34) ^&#038;”文件夹不存在，请确认！”,64  >> c:\diff.vbs<br />
echo       exit function  >> c:\diff.vbs<br />
echo   end if  >> c:\diff.vbs<br />
echo   if not(Fso.folderexists(ddir)) then  >> c:\diff.vbs<br />
echo       msgbox chr(34) ^&#038;ddir ^&#038;”"”文件夹不存在，请确认！”,64  >> c:\diff.vbs<br />
echo       exit function  >> c:\diff.vbs<br />
echo   end if  >> c:\diff.vbs<br />
echo   if right(sdir,1)^<^>“\” then sdir=sdir ^&#038;”\”  >> c:\diff.vbs<br />
echo   set dFol=fso.getfolder(ddir)  >> c:\diff.vbs<br />
echo   set dfs=dfol.files  >> c:\diff.vbs<br />
echo   for each f1 in dfs  >> c:\diff.vbs<br />
echo       if fso.fileexists(sdir ^&#038; f1.name)  then  >> c:\diff.vbs<br />
echo           set sf1=fso.GetFile(sdir ^&#038; f1.name)  >> c:\diff.vbs<br />
echo           if f1.DateLastModified ^<^>sf1.DateLastModified or  >> c:\diff.vbs</p>
<p>f1.size^<^>sf1.size echo then  >> c:\diff.vbs<br />
echo               f1.delete  >> c:\diff.vbs<br />
echo           end if  >> c:\diff.vbs<br />
echo         else  >> c:\diff.vbs<br />
echo           f1.Delete(true)  >> c:\diff.vbs<br />
echo         end if  >> c:\diff.vbs<br />
echo     next  >> c:\diff.vbs<br />
echo   dim fols  >> c:\diff.vbs<br />
echo   set fols=dfol.subfolders  >> c:\diff.vbs<br />
echo   for each f1 in fols  >> c:\diff.vbs<br />
echo       if not fso.folderexists(sdir ^&#038;f1.name) then  >> c:\diff.vbs<br />
echo             f1.delete true  >> c:\diff.vbs<br />
echo       else     >> c:\diff.vbs<br />
echo           comparefile sdir ^&#038; f1.name,f1.path  >> c:\diff.vbs<br />
echo       end if  >> c:\diff.vbs<br />
echo   next  >> c:\diff.vbs<br />
echo end function  >> c:\diff.vbs<br />
echo comparefile sdir,ddir  >> c:\diff.vbs</p>
]]></content:encoded>
			<wfw:commentRss>http://www.viyin.net/2010/07/vbs%e5%af%b9%e6%af%94%e6%9b%b4%e6%96%b0%e5%88%a0%e9%99%a4.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>对比更新 vbs</title>
		<link>http://www.viyin.net/2010/03/%e5%af%b9%e6%af%94%e6%9b%b4%e6%96%b0-vbs.html</link>
		<comments>http://www.viyin.net/2010/03/%e5%af%b9%e6%af%94%e6%9b%b4%e6%96%b0-vbs.html#comments</comments>
		<pubDate>Fri, 26 Mar 2010 09:26:32 +0000</pubDate>
		<dc:creator>vi</dc:creator>
				<category><![CDATA[√文章精选]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[对比更新]]></category>
		<category><![CDATA[差异备份]]></category>
		<category><![CDATA[差异复制]]></category>
		<category><![CDATA[批处理]]></category>

		<guid isPermaLink="false">http://www.viyin.net/?p=710</guid>
		<description><![CDATA[Option Explicit &#160; sub copyfol(sDir,Ddir) &#160;'sDiry要对比的文件夹，,Ddir要操作文件夹 &#160;&#160; dim fso,fol,fs,f1, objfile &#160;&#160; dim arrFiles(),arrSize(),arrModified() &#160;&#160; dim i &#160;&#160; if right(ddir,1)&#60;&#62;&#34;\&#34; then ddir =ddir &#38; &#34;\&#34; &#160;&#160; if right(sdir,1)&#60;&#62;&#34;\&#34; then sdir =sdir &#38; &#34;\&#34; &#160;&#160; Set fso = CreateObject(&#34;Scripting.FileSystemObject&#34;) &#160;&#160; '判断文件是否存在 &#160;&#160; if not (fso.FolderExists(sdir))&#160; then &#160;&#160; &#160; &#160; msgbox &#34;找不到文件夹：&#34; &#38; sdir &#160;&#160; &#160; &#160; exit [...]]]></description>
			<content:encoded><![CDATA[<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">Option Explicit</li>
<li>&nbsp;</li>
<li>sub copyfol(sDir,Ddir)</li>
<li>&nbsp;'sDiry要对比的文件夹，,Ddir要操作文件夹</li>
<li>&nbsp;&nbsp; dim fso,fol,fs,f1, objfile</li>
<li>&nbsp;&nbsp; dim arrFiles(),arrSize(),arrModified()</li>
<li>&nbsp;&nbsp; dim i</li>
<li>&nbsp;&nbsp; if right(ddir,1)&lt;&gt;&quot;\&quot; then ddir =ddir &amp; &quot;\&quot;</li>
<li>&nbsp;&nbsp; if right(sdir,1)&lt;&gt;&quot;\&quot; then sdir =sdir &amp; &quot;\&quot;</li>
<li>&nbsp;&nbsp; Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)</li>
<li>&nbsp;&nbsp; '判断文件是否存在</li>
<li>&nbsp;&nbsp; if not (fso.FolderExists(sdir))&nbsp; then</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; msgbox &quot;找不到文件夹：&quot; &amp; sdir</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; exit sub</li>
<li>&nbsp;&nbsp; end if</li>
<li>&nbsp;&nbsp; if not (fso.FolderExists(ddir))&nbsp; then</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;msgbox &quot;找不到文件夹：&quot; &amp; sdir</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;exit sub</li>
<li>&nbsp;&nbsp; end if</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; '获得要操作的文件列表及相关信息并储存到数组</li>
<li>&nbsp;&nbsp; set fol=fso.GetFolder(ddir)</li>
<li>&nbsp;&nbsp; set fs=fol.files</li>
<li>&nbsp;&nbsp; i=0</li>
<li>&nbsp;&nbsp; redim arrFiles(fs.count-1)</li>
<li>&nbsp;&nbsp; redim arrSize(fs.count-1)</li>
<li>&nbsp;&nbsp; redim arrModified(fs.count-1)</li>
<li>&nbsp;&nbsp; for each f1 in fs</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;arrfiles(i)=f1.name</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;arrSize(i)=f1.size</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;arrModified(i)=f1.DateLastModified</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;i=i+1</li>
<li>&nbsp;&nbsp; next</li>
<li>&nbsp;&nbsp; '把要操作的文件夹逐一根要对比的文件比较,不同则覆盖,多余就删除,没有就复制</li>
<li>&nbsp;&nbsp; set fol=fso.GetFolder(sdir)</li>
<li>&nbsp;&nbsp; set fs=fol.files</li>
<li>&nbsp;&nbsp; for i = 0 to ubound(arrfiles)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; '文件存在则比较是否相同,否则删除</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; dim delfile&nbsp; '要操作类型,</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; delfile=false</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; for each f1 in fs</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if strcomp(arrfiles(i),f1.name,vbTextCompare)=0 then&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if arrsize(i)&lt;&gt; f1.size or arrModified(i)&lt;&gt;f1.DateLastModified then</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fso.copyfile f1.path, ddir &amp; arrfiles(i),true&nbsp; &nbsp; &nbsp; &nbsp;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end if</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delfile=true '如果文件存在</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit for</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end if</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;next</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if not delfile then&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;set objfile=fso.getfile(ddir &amp;arrfiles(i))</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;objfile.Delete (true)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; end if&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
<li>&nbsp;&nbsp; &nbsp;next</li>
<li>&nbsp;&nbsp; '如果对比目录sdir中有文件是要操作目录ddir中没有的,则复制到ddir</li>
<li>&nbsp;&nbsp; for each f1 in fs</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; delfile=false</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; for i=0 to ubound(arrfiles)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if strcomp(f1.name,arrfiles(i),vbtextcompare)=0 then</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delfile=true</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit for</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end if</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;next </li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; if right (ddir,1)&lt;&gt;&quot;\&quot; then ddir=ddir &amp;&quot;\&quot;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if not delfile then&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f1.copy ddir,true</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;end if</li>
<li>&nbsp;&nbsp; next</li>
<li>&nbsp;&nbsp; '以下代码处理子文件夹&nbsp; </li>
<li>&nbsp;&nbsp; dim fols</li>
<li>&nbsp;&nbsp; set fol=Fso.GetFolder(sdir)</li>
<li>&nbsp;&nbsp; set fols=fol.SubFolders</li>
<li>&nbsp;&nbsp; for each f1 in fols</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;if not (fso.FolderExists(ddir &amp; f1.name)) then </li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; fso.CreateFolder(ddir &amp; f1.name)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;end if</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;copyfol sdir &amp; f1.name ,ddir &amp; f1.name</li>
<li>&nbsp;&nbsp; next</li>
<li>end sub</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; '以下是对比路径 第一个是远程路径 第二个是本地路径</li>
<li>copyfol &quot;c:\viyin.net&quot;,&quot;C:\www.viyin.net&quot;</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.viyin.net/2010/03/%e5%af%b9%e6%af%94%e6%9b%b4%e6%96%b0-vbs.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>dnf</title>
		<link>http://www.viyin.net/2010/03/dnf.html</link>
		<comments>http://www.viyin.net/2010/03/dnf.html#comments</comments>
		<pubDate>Tue, 16 Mar 2010 03:19:47 +0000</pubDate>
		<dc:creator>vi</dc:creator>
				<category><![CDATA[√文章精选]]></category>
		<category><![CDATA[bat]]></category>
		<category><![CDATA[dnf]]></category>
		<category><![CDATA[批处理]]></category>
		<category><![CDATA[替换]]></category>
		<category><![CDATA[检测]]></category>
		<category><![CDATA[脚本]]></category>

		<guid isPermaLink="false">http://www.viyin.net/?p=697</guid>
		<description><![CDATA[@echo off type D:\DNF1\DNF_CHINA.CFG &#124; find /i “NOTIFYING_MINIMAP=1&#8243; &#038;&#038;echo on &#038;&#038;goto run for /l %%a in (1,1,10) do ( type D:\DNF1\DNF_CHINA.CFG &#124; find /i “NOTIFYING_MINIMAP=1&#8243; &#038;&#038;echo on &#038;&#038;goto run ping 127.1 -n 2 >nul ) exit :run @echo off for /f “delims=” %%i in (&#8216;dir /b/s/a-d “D:\DNF1\DNF_CHINA.CFG”&#8216;) do ( findstr /v “[CH” “%%i” >”%%~dpni.new” del [...]]]></description>
			<content:encoded><![CDATA[<p>@echo off<br />
type D:\<a href="http://www.viyin.net/tag/dnf" class="st_tag internal_tag" rel="tag" title="标签 dnf 下的日志">DNF</a>1\<a href="http://www.viyin.net/tag/dnf" class="st_tag internal_tag" rel="tag" title="标签 dnf 下的日志">DNF</a>_CHINA.CFG | find /i “NOTIFYING_MINIMAP=1&#8243;  &#038;&#038;echo on &#038;&#038;goto run</p>
<p>for /l %%a in (1,1,10) do (</p>
<p>type D:\DNF1\DNF_CHINA.CFG | find /i “NOTIFYING_MINIMAP=1&#8243;  &#038;&#038;echo on &#038;&#038;goto run</p>
<p>ping 127.1 -n 2 >nul</p>
<p>)</p>
<p>exit</p>
<p>:run<br />
@echo off</p>
<p>for /f “delims=” %%i in (&#8216;dir /b/s/a-d “D:\DNF1\DNF_CHINA.CFG”&#8216;) do (<br />
findstr /v “[CH” “%%i” >”%%~dpni.new”<br />
del /q “%%i”<br />
ren “%%~dpni.new” “%%~ni.CFG”<br />
) </p>
<p>for /f “delims=” %%i in (&#8216;dir /b/s/a-d “D:\DNF1\DNF_CHINA.CFG”&#8216;) do (<br />
findstr /v “NOTIFYING_” “%%i” >”%%~dpni.new”<br />
del /q “%%i”<br />
ren “%%~dpni.new” “%%~ni.CFG”<br />
) </p>
<p>exit</p>
]]></content:encoded>
			<wfw:commentRss>http://www.viyin.net/2010/03/dnf.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>批处理删除指定行</title>
		<link>http://www.viyin.net/2010/03/669.html</link>
		<comments>http://www.viyin.net/2010/03/669.html#comments</comments>
		<pubDate>Mon, 01 Mar 2010 02:05:35 +0000</pubDate>
		<dc:creator>vi</dc:creator>
				<category><![CDATA[√文章精选]]></category>
		<category><![CDATA[删除指定行]]></category>
		<category><![CDATA[批处理]]></category>

		<guid isPermaLink="false">http://www.viyin.net/?p=669</guid>
		<description><![CDATA[批处理删除指定行 @echo off for /f “delims=” %%i in (&#8216;dir /b/s/a-d “C:\文件路径”&#8216;) do ( findstr /v “要指定删除行包含的字符” “%%i” &#62;”%%~dpni.new” del /q “%%i” ren “%%~dpni.new” “%%~ni.ini” )]]></description>
			<content:encoded><![CDATA[<p>批处理删除指定行</p>
<p>@echo off<br />
for /f “delims=” %%i in (&#8216;dir /b/s/a-d “C:\文件路径”&#8216;) do (<br />
findstr /v “要指定删除行包含的字符” “%%i” &gt;”%%~dpni.new”<br />
del /q “%%i”<br />
ren “%%~dpni.new” “%%~ni.ini”<br />
)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.viyin.net/2010/03/669.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>替换文本中的字符</title>
		<link>http://www.viyin.net/2010/02/cmd-bat-vbs.html</link>
		<comments>http://www.viyin.net/2010/02/cmd-bat-vbs.html#comments</comments>
		<pubDate>Sat, 06 Feb 2010 02:37:07 +0000</pubDate>
		<dc:creator>vi</dc:creator>
				<category><![CDATA[√文章精选]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[批处理]]></category>
		<category><![CDATA[替换字符]]></category>

		<guid isPermaLink="false">http://www.viyin.net/?p=638</guid>
		<description><![CDATA[echo Set fso = Wscript.CreateObject(“Scripting.FileSystemObject”)&#62;c:\viyin.vbs echo set f=fso.opentextfile(“D:\DNF1\DNF_CHINA.CFG”)&#62;&#62;c:\viyin.vbs echo s=replace(f.readall,”MUSIC VOLUME=100&#8243;,”MUSIC VOLUME=0&#8243;)&#62;&#62;c:\viyin.vbs echo f.close&#62;&#62;c:\viyin.vbs echo set   r=fso.opentextfile(“D:\DNF1\DNF_CHINA.CFG”,2,true)&#62;&#62;c:\viyin.vbs echo r.write  s&#62;&#62;c:\viyin.vbs echo Wscript.quit&#62;&#62;c:\viyin.vbs start c:\viyin.vbs echo Set fso = Wscript.CreateObject(“Scripting.FileSystemObject”)&#62;c:\viyin.vbs echo set f=fso.opentextfile(“D:\DNF1\DNF_CHINA.CFG”)&#62;&#62;c:\viyin.vbs echo s=replace(f.readall,”SOUND VOLUME=100&#8243;,”SOUND VOLUME=0&#8243;)&#62;&#62;c:\viyin.vbs echo f.close&#62;&#62;c:\viyin.vbs echo set   r=fso.opentextfile(“D:\DNF1\DNF_CHINA.CFG”,2,true)&#62;&#62;c:\viyin.vbs echo r.write  s&#62;&#62;c:\viyin.vbs echo Wscript.quit&#62;&#62;c:\viyin.vbs start c:\viyin.vbs]]></description>
			<content:encoded><![CDATA[<p>echo Set fso = Wscript.CreateObject(“Scripting.FileSystemObject”)&gt;c:\viyin.<a href="http://www.viyin.net/tag/vbs" class="st_tag internal_tag" rel="tag" title="标签 vbs 下的日志">vbs</a><br />
echo set f=fso.opentextfile(“D:\<a href="http://www.viyin.net/tag/dnf" class="st_tag internal_tag" rel="tag" title="标签 dnf 下的日志">DNF</a>1\<a href="http://www.viyin.net/tag/dnf" class="st_tag internal_tag" rel="tag" title="标签 dnf 下的日志">DNF</a>_CHINA.CFG”)&gt;&gt;c:\viyin.vbs<br />
echo s=replace(f.readall,”MUSIC VOLUME=100&#8243;,”MUSIC VOLUME=0&#8243;)&gt;&gt;c:\viyin.vbs<br />
echo f.close&gt;&gt;c:\viyin.vbs<br />
echo set   r=fso.opentextfile(“D:\DNF1\DNF_CHINA.CFG”,2,true)&gt;&gt;c:\viyin.vbs<br />
echo r.write  s&gt;&gt;c:\viyin.vbs<br />
echo Wscript.quit&gt;&gt;c:\viyin.vbs<br />
start c:\viyin.vbs<br />
echo Set fso = Wscript.CreateObject(“Scripting.FileSystemObject”)&gt;c:\viyin.vbs<br />
echo set f=fso.opentextfile(“D:\DNF1\DNF_CHINA.CFG”)&gt;&gt;c:\viyin.vbs<br />
echo s=replace(f.readall,”SOUND VOLUME=100&#8243;,”SOUND VOLUME=0&#8243;)&gt;&gt;c:\viyin.vbs<br />
echo f.close&gt;&gt;c:\viyin.vbs<br />
echo set   r=fso.opentextfile(“D:\DNF1\DNF_CHINA.CFG”,2,true)&gt;&gt;c:\viyin.vbs<br />
echo r.write  s&gt;&gt;c:\viyin.vbs<br />
echo Wscript.quit&gt;&gt;c:\viyin.vbs<br />
start c:\viyin.vbs</p>
]]></content:encoded>
			<wfw:commentRss>http://www.viyin.net/2010/02/cmd-bat-vbs.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

