eben80 Posted April 6, 2010 Posted April 6, 2010 (edited) Hi all, I have looked though all the search results on the text search topic but couldn't find anything that do what I need it to do. part of my script creates a dump file of the cipher command on a particular folder. I need the script to then look for the occurrence of " U " anywhere in the text file but I'm having problems loading the whole text file into a variable... I only get the first line when I try to display it. The text file is called efs_dump.log: expandcollapse popupListing C:\Documents and Settings\My Documents\ New files added to this directory will not be encrypted. U 10Feb.csv U 18FebDR.csv U 22FebDR.csv U 23FebDR.csv U 24FebDR.csv U 2K7.csv U BO_Diff.xls U EFS-Report.xls U EFS-Report_Template.xls U EFS-Report_V2.xls U EFS-Report_V3.xls U IE7_Cardiff.csv U IE7_Exclusions.csv U Log Viewer U maps.txt U My Music U My Pictures U My Videos U My Virtual Machines U PM_Reports U Power Managment Summary 06032010.xls U PowerManagemen.xls U SAP_Patch_14_UVT.csv U SAP_Test_Devices.csv U SAP_UPgrade15032010.csv U SWDReport_template.v4.0.xls Listing C:\Documents and Settings\3rdellewsdfgdsgee\My Documents\Log Viewer\ New files added to this directory will not be encrypted. U Altiris.Diagnostics.dll U LogViewer.exe U SourceGrid2.dll U SourceLibrary.dll Listing C:\Documents and Settings\3rdesfdasfllewee\My Documents\My Data Sources\ New files added to this directory will not be encrypted. U +Connect to New Data Source.odc U +New SQL Server Connection.odc U DATACONN.HTC Listing C:\Documents and Settings\3rdellewee\My Documents\My Music\ New files added to this directory will not be encrypted. U Sample Music.lnk Listing C:\Documents and Settings\3rdellewee\My Documents\My Pictures\ New files added to this directory will not be encrypted. U Sample Pictures.lnk U tssdfysdfassftems.ico Listing C:\Documents and Settings\3rdelsfasflewee\My Documents\My Videos\ New files added to this directory will not be encrypted. Listing C:\Documents and Settings\3sadfsfrdellewee\My Documents\My Virtual Machines\ New files added to this directory will not be encrypted. Listing C:\Documents and Settings\3rdellsfsfdwee\My Documents\PM_Reports\ New files added to this directory will not be encrypted. U 16032010.xls U 17032010.xls U 18032010.xls How do I get the script to set a boolean if ANY " U " is found in the whole text file? I've tried FileRead, FileReadLine with loops etc etc. but I don't get the full text of the file. This is one of my attempts: $ourProcess22 = Run(@ComSpec & " /c" & "cipher.exe /S:""C:\Documents and Settings\" & @UserName & "\My Documents"" > C:\Support\Logs\efs_dump.log", "", @SW_HIDE, 2) $dumpfile = "C:\support\logs\efs_dump.log" $dumpstring = FileRead($dumpfile) MsgBox(0, "String", $dumpstring) $recurse_encrypted = StringInStr($dumpstring, " U ") MsgBox(0, "Found", $recurse_encrypted) Please help Edited April 6, 2010 by eben80
nf67 Posted April 6, 2010 Posted April 6, 2010 I need the script to then look for the occurrence of " U " anywhere in the text fileAnywhere really, or just the start of a line, as in your file?
somdcomputerguy Posted April 6, 2010 Posted April 6, 2010 I created a text file named 'efs_dump.log' with the contents you supplied. The text file and the script are both in the same directory, but they don't have to be. $dumpfile = "efs_dump.log" $dumpstring = FileRead($dumpfile) MsgBox(0, "String", $dumpstring) If StringInStr($dumpstring, " U ") Then ConsoleWrite("yay!" & @LF) - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now