Jump to content
Sign in to follow this  
hackersarchangel

Parse and edit a txt file so it's readable

Recommended Posts

hackersarchangel

Ok so I am working on a wrapper to launch chkdsk with parameters through a PE enviroment. I have it working as far as executing chkdsk, albeit crudely. The biggest hurdle is getting it to process the log file and make it readable, as it appends to it weird.

I'll post a log file shortly, need to test it on both drives to see if it's that different between them.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • RedneckTech
      By RedneckTech
      So I'm working on a general maintenance script. Part of it is to run chkdsk (just check no /f /r) and report that to a file. So far whenever i run the script, everything works perfectly, but i get errors on the chkdsk readout file, but then if i follow up with running chkdsk manually i get no errors. even piping results to a file.

      so far has happened on a Dell XPS and Dell Precision both using the original factory image (Win 7), and a Dell Vostro 200 (Win XP)that has been reformatted like a week ago.

      The error is always with the volume bitmap.

      Here's the script im running:


      If ProcessExists ("chkdsk.exe") <> 0 Then $pretime = TimerInit() While ProcessExists("chkdsk.exe") <> 0 Sleep(1000) If TimerDiff($pretime) >= 1800000 Then FileWriteLine ( $DiskSick, _NowCalc() & " Checkdisk was already running. Appears to be hung") $Defrag = 0 ExitLoop EndIf WEnd Else FileDelete (@WorkingDir & "Checklog.txt") Sleep(1000) $checklog = @WorkingDir & "Checklog.txt" $qchecklog = Chr(34) & $checklog & Chr(34) Run (@ComSpec & " /c chkdsk >> " & $qchecklog) $runinit = TimerInit() While ProcessExists("chkdsk.exe") <> 0 Sleep(1000) If TimerDiff($runinit) >= 1800000 Then FileWriteLine ($DiskSick, _NowCalc() & " Checkdisk appears to have hung") $Defrag = 0 ExitLoop EndIf WEnd While ProcessExists("cmd.exe") <> 0 Sleep(1000) If TimerDiff($runinit) >= 1800000 Then FileWriteLine ($DiskSick, _NowCalc() & " Checkdisk appears to have hung") $Defrag = 0 ExitLoop EndIf WEnd EndIf
      edit. Fixed the autoIT to show loops correctly
    • hackersarchangel
      By hackersarchangel
      Ok I'm starting work on a project that will be automating chkdsk under a Windows PE based enviroment. Since the final project will be open source, I'm inviting people to join the team in helping make it a successful project and once it's developed to a 1.0 stage, it will mostly be bugfixes/corrections from there on out. I have already made a basic GUI that I will attach to the thread later when I'm at the computer I have it saved on.

      The goals of the project:
      Make a functioning GUI that automatically runs chkdsk after drive selections are made Will log all output to a location specified by the user Will give options to choose what options to add to chkdsk, /X /R /F being the three biggest ones. An option to run in multiple passes. Anyone that is willing to set aside some dedicated time to sit down, discuss best way to proceed, and help with programming will receive credit where due.
      Oh and anyone looking to help with bug-testing is welcome as well

      File attached, I had discovered a mockup I made originally as an example to show a possible layout.
      checkthatdrive.au3
    • hackersarchangel
      By hackersarchangel
      I have a project I'm working on, as part of a maintenance disk. I want to make a GUI for automating chkdsk startup, as in I run the GUI, then I select what drives I'm wanting to chkdsk. I want to run this from a PE based enviroment, I believe the disk I've chosen is a BartPE based disk, if that matters.

      Here's where my issue comes into play. When I start the program I have it set to specify a log save location with a Save As box. That part works great, so I have it make the GUI. Here's the issue: When I'm making the GUI, I want it to grab the drive letters and use that as part of either Checkboxes OR multiple dropdown menus. That part I'm flexible on, I just want it to work, and the dropdown menus was just another way of thinking about it.

      So I figured out how to grab drive letters into an array and do an If-Then for less than 4 drives (test machine has 3 drives, trying to get it work before worrying about whether or not it's less than 2 or 3):



      Global $Drives[5] = ["1","2","3","4","5"] $Drives = DriveGetDrive("Fixed") If $Drives[0] < 4 Then $Drives[4] = "None" EndIf

      For some reason, when I run that code, it flips it's lid about being outside my subscript range. I added the ReDim command to resize it back to 5, but that still doesn't work. Now if I set it when I initialize it, it's fine, and I can edit it all I want to manually, just not with DriveGetDrive.

      Current modified code:


      Global $Drives[5] = ["1","2","3","4","5"] $Drives = DriveGetDrive("Fixed") If $Drives[0] < 4 Then ReDim $Drives[5] $Drives[4] = "None" EndIf
      What I would like to do is resize the Array to fix the amount of drives I have, i.e. if I have 2 drives, make it 3 slots big, [0] for the count it generates, [1] for drive 1, [2] for drive 2, etc. and if it doesn't get a reply from slots 3 and 4, disable those checkboxes/remove the entry from the dropdown list. But that is further complicating the issue as it is, just want the basic premise to work.

      If anyone has any ideas for this little issue, I'm welcoming the ideas.
×