Loading |
VBScript |
JavaScript |
Powershell |
Search Options: Take Action Based on the First Line of a Text FileContent of Take Action Based on the First Line of a Text File.vbsMD5 Hash: 6CC1D3B0E85A3683803F4DF0E675C3F8 |
||
Const ForReading = 1
strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery _ ("ASSOCIATORS OF {Win32_Directory.Name='C:\Scripts'} Where " _ & "ResultClass = CIM_DataFile") Set objFSO = CreateObject("Scripting.FileSystemObject") For Each objItem In colItems Set objFile = objFSO.OpenTextFile(objItem.Name, ForReading) strLine = objFile.ReadLine strLine = LCase(strLine) objFile.Close If InStr(strLine, "fabrikam.com") or InStr(strLine, "contoso.com") Then objFSO.MoveFile objItem.Name, "C:\Archive\" End If Next | ||
© 2008 - 2013 Boris Toll :: Scripts available: 6.481 :: :: scriptbox.toll.at :: :: powered by www.toll.at :: |