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 ...
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
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.
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.
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.
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"
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....