+ Post New Thread
Results 1 to 7 of 7
Scripts Thread, Modifiying .ini's within a certain directory in Coding and Web Development; A brief background; We are running an RM CC3 network and have a directory containing an .ini relevant to each ...
  1. #1
    Jenko22's Avatar
    Join Date
    May 2007
    Location
    Truro
    Posts
    26
    Thank Post
    1
    Thanked 4 Times in 4 Posts
    Rep Power
    15

    Modifiying .ini's within a certain directory

    A brief background;
    We are running an RM CC3 network and have a directory containing an .ini relevant to each machine on the network with a line for each .msi allocated and its installation status (i.e. Installed,Install_pending,install_failed)

    When an install fails it needs to be deleted from the .ini so the machine can retry the install on the next reboot, searching and deleting every install_failed from these files can be time consuming if there is a problem.

    I spent a morning in visual basic trying to automate it a bit and made some progress but am now hoping someone with more knowledge can help. I have four command buttons which
    - create a list box with every .ini from a specified directory.
    - read the contents of an .ini file into a separate list box
    - search that list box for any line containing INSTALL_FAILED and remove it
    - saves the modified list box back to the .ini

    This works to an extent but obviously requires you to press 3 buttons for every .ini file. Could anyone help me streamline this to run through every file with one click.

    I've attached the code if anyone thinks they can help, sorry for the length of this
    Attached Files Attached Files

  2. #2

    Join Date
    Feb 2006
    Posts
    1,187
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Re: Modifiying .ini's within a certain directory

    Why not try the following at the command line:
    Code:
     FOR /R %f IN  (*.ini) DO  type "%f" | find /V "INSTALL_FAILED" > "%f"

    The only problem is that it will process every INI but it saves a bit of typing.

  3. #3

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,412
    Thank Post
    642
    Thanked 963 Times in 663 Posts
    Blog Entries
    2
    Rep Power
    326

    Re: Modifiying .ini's within a certain directory

    Hi,

    We run a CC3 network as well and we find that Package Log Monitor is pretty good. We also have a program by N Bentley called Package Analyser which is a bit more advanced but we can't remember where we got it from.

  4. #4
    Jenko22's Avatar
    Join Date
    May 2007
    Location
    Truro
    Posts
    26
    Thank Post
    1
    Thanked 4 Times in 4 Posts
    Rep Power
    15

    Re: Modifiying .ini's within a certain directory

    Quote Originally Posted by NetworkGeezer
    Why not try the following at the command line:
    Code:
     FOR /R %f IN  (*.ini) DO  type "%f" | find /V "INSTALL_FAILED" > "%f"

    The only problem is that it will process every INI but it saves a bit of typing.
    Just tested this on a copy of some of the files just seems to empty the file. Cant quite get my head around what its doing so not sure where its going wrong.

  5. #5
    Jenko22's Avatar
    Join Date
    May 2007
    Location
    Truro
    Posts
    26
    Thank Post
    1
    Thanked 4 Times in 4 Posts
    Rep Power
    15

    Re: Modifiying .ini's within a certain directory

    Quote Originally Posted by webman
    Hi,

    We run a CC3 network as well and we find that Package Log Monitor is pretty good. We also have a program by N Bentley called Package Analyser which is a bit more advanced but we can't remember where we got it from.
    Thanks for those i had a look at Package Log Monitor and also managed to track down Package Analyser which is exactly what we're looking for.

    For anyone else who's interested
    Package Analyser Monitor

  6. #6

    Join Date
    Feb 2006
    Posts
    1,187
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Re: Modifiying .ini's within a certain directory

    Quote Originally Posted by Jenko22
    Just tested this on a copy of some of the files just seems to empty the file. Cant quite get my head around what its doing so not sure where its going wrong.
    The FOR /R %f in (*.INI) recurisivley finds every instance of an INI file and assigns its path to the variable %f

    The type command just reads the file pointed to by %f

    The /V switch to the find command displays every line not containing the search string (in this case "INSTALL_FAILED" ) and hence removes it.

    The last part was to pipe (write) it back to the original file but it looks like the shell may still be reading the ini file when we try to write back to it.

    I have changed the code to use a temp file
    Code:
     FOR /R %f IN  (*.ini) DO  type "%f" | find /V "INSTALL_FAILED" > some_temp_file.txt & move /Y some_temp_file.txt "%f"

  7. #7

    Join Date
    Aug 2007
    Location
    Birmingham U.K.
    Posts
    20
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Re: Modifiying .ini's within a certain directory

    I did it by pointing a file list box to the correct UNC path and setting it's mask to be *.ini Then i just went through the file list box reading each ini file and checking it. You can get the filenames using a for next loop as it is basically just a list box....

    Hope that was some help.

SHARE:
+ Post New Thread

Similar Threads

  1. Active Directory Auditing??
    By ICTNUT in forum How do you do....it?
    Replies: 8
    Last Post: 28th November 2012, 02:21 AM
  2. PDA and Active Directory
    By localzuk in forum Windows
    Replies: 4
    Last Post: 10th October 2007, 03:54 PM
  3. script for active directory
    By chalkwellstu in forum Scripts
    Replies: 8
    Last Post: 24th September 2007, 01:53 PM
  4. DNS problem under Active Directory.
    By ArchersIT in forum Windows
    Replies: 6
    Last Post: 19th February 2007, 03:09 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •