Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

How to merge two text files?

- - - - -

  • Please log in to reply
237 replies to this topic

#76
tomasz86

tomasz86

    www.windows2000.tk

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,520 posts
  • Joined 27-November 10
  • OS:XP Pro x86
  • Country: Country Flag
I have a fixed list of files, let's say:

1.dll
2.dll
3.dll
...
100. dll (all filenames are different, here it's just an example)

I would like to copy each of them only if the file exists. Is there any better way than doing it like this?

IF EXIST 1.dll COPY 1.dll <destination>
IF EXIST 2.dll COPY 2.dll <destination>
etc.

Edited by tomasz86, 31 July 2011 - 07:47 AM.

Posted Image
Unofficial Service Pack 5.2 for MS Windows 2000 <- use this topic if you need help with UURollup, Update Rollup 2 and other unofficial packages


How to remove advertisement from MSFN

#77
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,401 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

I have a fixed list of files, let's say:

1.dll
2.dll
3.dll
...
100. dll (all filenames are different, here it's just an example)

I would like to copy each of them only if the file exists. Is there any better way than doing it like this?

IF EXIST 1.dll COPY 1.dll <destination>
IF EXIST 2.dll COPY 2.dll <destination>
etc.


Is the <destination> always the same?





Or can you use a "configuration file" (like a CSV)?
LIke:
1.dll ,"C:\Windows\Whatever\"
2.dll,"C:\Somewhere Else\"
....
<source file>,<target destnation>

You do a FOR loop:
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
FOR /F "tokens=1,2 delims=," %%A IN (Files_to_copy.csv) DO (
ECHO IF EXIST %%A  COPY /B %%A %%B
)

jaclaz

#78
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,534 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

I have a fixed list of files, let's say:

1.dll
2.dll
3.dll
...
100. dll (all filenames are different, here it's just an example)

I would like to copy each of them only if the file exists. Is there any better way than doing it like this?

IF EXIST 1.dll COPY 1.dll <destination>
IF EXIST 2.dll COPY 2.dll <destination>
etc.

I'm intrigued as to what you feel needs improvement in the samples you've provided.

You cannot copy what doesn't exist!

#79
tomasz86

tomasz86

    www.windows2000.tk

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,520 posts
  • Joined 27-November 10
  • OS:XP Pro x86
  • Country: Country Flag
Yzöwl,

I have a list of files (hundreds of files), ex.

Spoiler


Changing everything manually to

IF EXIST _DEFAULT.PI_ COPY _DEFAULT.PI_ <destination>
IF EXIST 0401.CS_ COPY 0401.CS_ <destination>
takes too much time. If I do just

COPY _DEFAULT.PI_ <destination>
COPY 0401.CS_ <destination>
then there is a "file not found" error on the screen (when the file doesn't exist) and the script is also much slower as it tries to copy all these files one by one.

Edited by tomasz86, 31 July 2011 - 09:53 AM.

Posted Image
Unofficial Service Pack 5.2 for MS Windows 2000 <- use this topic if you need help with UURollup, Update Rollup 2 and other unofficial packages

#80
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,401 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

Changing everything manually to

The WHOLE idea about batch files is that you DO NOT change hundreds of lines manually!

That's ALSO exactly the ide of having a "configuration file".

You have same command line (which you change just once) and a LIST of files (source/destination) that it's much easier to create or change.


then there is a "file not found" error on the screen (when the file doesn't exist) ....

Meet REDIRECTION of standard output and standard error ;):
http://www.robvander...redirection.php

Also, please, ALWAYS use COPY /B when copying files, you never know:
http://ss64.com/nt/copy.html

This:
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
SET DESTINATION=C:\somewhere\
ECHO.>newfile.cmd
FOR /F "tokens=* delims=" %%A IN (list_of_dlls.txt) DO (
ECHO IF EXIST %%A  COPY /B %%A %DESTINATION%>>newfile.cmd
)
Will create a new file "newfile.cmd" with all the entries in your list of dll's "list_of_dlls.txt" automatically (as opposed to manually)


jaclaz

Edited by jaclaz, 31 July 2011 - 10:09 AM.


#81
tomasz86

tomasz86

    www.windows2000.tk

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,520 posts
  • Joined 27-November 10
  • OS:XP Pro x86
  • Country: Country Flag
It works. Thank you :thumbup

I'll use COPY /B from now... is there something similar with MOVE?
Posted Image
Unofficial Service Pack 5.2 for MS Windows 2000 <- use this topic if you need help with UURollup, Update Rollup 2 and other unofficial packages

#82
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,534 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

Using COPY /B serves no purpose when used in that manner, in fact it is the default mode when copying single files.

#83
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,401 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

Using COPY /B serves no purpose when used in that manner, in fact it is the default mode when copying single files.

Are you sure?
The referenced page says the opposite. :unsure:
http://ss64.com/nt/copy.html

Maybe it changed between 2K and XP?
http://www.microsoft...y.mspx?mfr=true

jaclaz

#84
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,534 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

Are you saying that pre-XP the resulting file copied, C:\MyFiles\Binary.ext, as a result of the following doesn't work or is somehow broken?
IF NOT EXIST C:\MYFILES\ MD C:\MYFILES

COPY A:\BINARY.EXT C:\MYFILES


#85
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,401 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

Are you saying that pre-XP the resulting file copied, C:\MyFiles\Binary.ext, as a result of the following doesn't work or is somehow broken?[code=auto:0]IF NOT EXIST C:\MYFILES\ MD C:\MYFILES

NO, I am not.

I am saying what I said (and nothing else) ;).

I have always used /B (probably uneededly :blushing: ) because of the referenced page AND along the lines of "better be safe than sorry" philosophy.

Since it is common that the good MS guys almost silently change some little things in commands and their syntax, if the behaviour in earlier version was different then everything would make sense, or if you prefer I was trying to find an explanation why the SS64 site (normally very exact) carried some wrong info.

jaclaz

#86
tomasz86

tomasz86

    www.windows2000.tk

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,520 posts
  • Joined 27-November 10
  • OS:XP Pro x86
  • Country: Country Flag

@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
SET DESTINATION=C:\somewhere\
ECHO.>newfile.cmd
FOR /F "tokens=* delims=" %%A IN (list_of_dlls.txt) DO (
ECHO IF EXIST %%A  COPY /B %%A %DESTINATION%>>newfile.cmd
)

In the end I used this method as a basis:

SETLOCAL ENABLEEXTENSIONS
SET A=
SET B=
SET C=
FOR /F %%I IN ('DIR/A-D/B %A%') DO (
	IF EXIST %B%\%%I (
		COPY/B %B%\%%I %C%\
		)
	)

I also have another question related to this script. Is it possible to copy only specific files like "*.*_"? I tried adding

IF "%%~xI"==".*_"
but it doesn't work. It works only if the extension is specified, ex.
IF "%%~xI"==".dl_"

Nevermind, I got it work by changing

('DIR/A-D/B %A%')
to

('DIR/A-D/B %A%\*.*_')

Everything is fine but copying is very slow compared to just doing xcopy :}

Edited by tomasz86, 02 August 2011 - 09:05 AM.

Posted Image
Unofficial Service Pack 5.2 for MS Windows 2000 <- use this topic if you need help with UURollup, Update Rollup 2 and other unofficial packages

#87
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,534 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

It really depends upon the full intent of your script. You may be able to simply change the For command Dir output.

You need to be aware that asking for small changes throughout the Topic can completely ruin the final result. If you actually provide a full and complete explanation of the batch file requirements from the outset it is likely that the solution will better suit your intent.

As a side note, a file extension with an underscore suffix does not necessarily mean that the file is compressed.

#88
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,401 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

Everything is fine but copying is very slow compared to just doing xcopy :}

A new approach :w00t::
  • copy *everything* with XCOPY fast
  • delete what you DO NOT need :whistle:

jaclaz

#89
tomasz86

tomasz86

    www.windows2000.tk

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,520 posts
  • Joined 27-November 10
  • OS:XP Pro x86
  • Country: Country Flag
Yzöwl,

the script is connected with the other one for merging Win2k's updates ("merging text files..." topic). It's supposed to update files from Service Pack 4 with newer versions that come from the merged updates.

I already prepared it and it's working so I don't really need more help in this topic ;) I used strings like this one and that's why I asked for help.

FOR /F %%I IN ('DIR/A-D/B SPMER\i386\*.*_') DO (
		EXPAND -R SPMER\i386\%%I TEMP\ >NUL
		FOR /F %%I IN ('DIR/A-D/B TEMP') DO (
			ECHO Checking i386\%%I
			IF EXIST HFMER\%%I (
				ECHO Processing i386\%%I&ECHO.
				XCOPY/DY HFMER\%%I TEMP\ >NUL&DEL/Q HFMER\%%I >NUL
				MAKECAB /D CompressionMemory=21 /D CompressionType=LZX TEMP\%%I /L SPMER\i386 >NUL
			)
		DEL/Q/S TEMP\%%I >NUL
		)
	)

I have also rewritten everything in the other script for merging updates so now it's simpler and doesn't use any other (HFSLIP etc.) sources except for the parts where jaclaz's scripts are used. I'll post an updated version in the other topic after I combine both together as now they are two separate scripts.
Posted Image
Unofficial Service Pack 5.2 for MS Windows 2000 <- use this topic if you need help with UURollup, Update Rollup 2 and other unofficial packages

#90
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,534 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

Yzöwl,

the script is connected with the other one for merging Win2k's updates ("merging text files..." topic).


Okay, topics Merged.

#91
tomasz86

tomasz86

    www.windows2000.tk

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,520 posts
  • Joined 27-November 10
  • OS:XP Pro x86
  • Country: Country Flag
I want to edit lines in the original update.inf from w2k sp4 (after processing it by jaclaz's script to remove unnecessary spaces).

Is there any better (but still simple) way than this one?

SETLOCAL ENABLEDELAYEDEXPANSION


@ECHO OFF > update.txt
FOR /F "tokens=* delims= " %%I IN (update.inf) DO (
	IF "%%I"=="CatalogFile = sp4.cat" (
		ECHO ThisServicePackBuild = 1 >> update.txt
	) ELSE (
		ECHO %%I >> update.txt
	)
)

@ECHO OFF > update2.txt
FOR /F "tokens=* delims= " %%I IN (update.txt) DO (
	IF "%%I"=="MaxNtServicePackVersion = 1024 " (
		ECHO MaxNtServicePackVersion = 1536 >> update2.txt
	) ELSE (
		ECHO %%I >> update2.txt
	)
)

@ECHO OFF > update3.txt
FOR /F "tokens=* delims= " %%I in (update2.txt) do (
	IF "%%I"=="ThisServicePackVersion = 1024  " (
		ECHO ThisServicePackVersion = 1536 >> update3.txt
	) ELSE (
		ECHO %%I >> update3.txt
	)
)
The problem is that one space at the end of each line is added in each newer file so it goes like this:

IF "%%I"=="CatalogFile = sp4.cat" <- no space
IF "%%I"=="MaxNtServicePackVersion = 1024 "<- 1 space
IF "%%I"=="ThisServicePackVersion = 1024  " <- 2 spaces
...
The other issue is that the script doesn't work if the output files are '.inf' files instead of '.txt' files. Why is this so?

Edited by tomasz86, 04 August 2011 - 10:14 AM.

Posted Image
Unofficial Service Pack 5.2 for MS Windows 2000 <- use this topic if you need help with UURollup, Update Rollup 2 and other unofficial packages

#92
bphlpt

bphlpt

    MSFN Addict

  • Member
  • PipPipPipPipPipPipPip
  • 1,798 posts
  • Joined 12-May 07
  • OS:none specified
  • Country: Country Flag
The space problem is being caused because you're making things too "neat" and "human readable". You have a space before ">> update.txt", so it adds a space. Batch is usually very literal when it comes to using redirection and comparison testing. You don't need any spaces before or after the ">>" or ">", unless you are trying to add them on purpose. In your case, I think if you change your code to:

SETLOCAL ENABLEDELAYEDEXPANSION

@ECHO OFF>update.txt
FOR /F "tokens=* delims= " %%I IN (update.inf) DO (
        IF "%%I"=="CatalogFile = sp4.cat" (
                ECHO ThisServicePackBuild = 1>>update.txt
        ) ELSE (
                ECHO %%I>>update.txt
        )
)

@ECHO OFF>update2.txt
FOR /F "tokens=* delims= " %%I IN (update.txt) DO (
        IF "%%I"=="MaxNtServicePackVersion = 1024" (
                ECHO MaxNtServicePackVersion = 1536>>update2.txt
        ) ELSE (
                ECHO %%I>>update2.txt
        )
)

@ECHO OFF>update3.txt
FOR /F "tokens=* delims= " %%I in (update2.txt) do (
        IF "%%I"=="ThisServicePackVersion = 1024" (
                ECHO ThisServicePackVersion = 1536>>update3.txt
        ) ELSE (
                ECHO %%I>>update3.txt
        )
)

that should take care of your spacing problem.

Cheers and Regards

Posted Image


#93
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,534 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

I see a potential problem with the example supplied by bphlpt above:
ECHO ThisServicePackBuild = 1>> update.txt
The problem is that we generally use lazy redirection, when we write to stdout. ( >output.ext should be written as 1>output.ext )

This means that I'd expect stdout to not receive the value of ThisServicePackBuild.

#94
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,401 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag
As always Yzöwl is right, if you have no space between the 1 and the > you will redirect standard output to file.

You can always leave the spaces and post-process with gsar changing [SPACE][CR][LF] to [CR][LF] .... :unsure:

Or see if redirection BEFORE line works, see point #(3) here:
http://www.robvander...redirection.php

jaclaz

#95
allen2

allen2

    Not really Newbie

  • Member
  • PipPipPipPipPipPipPip
  • 1,812 posts
  • Joined 13-January 06
(ECHO ThisServicePackBuild = 1)>> update.txt
or
(ECHO ThisServicePackBuild = 1)1>> update.txt
will work.

#96
tomasz86

tomasz86

    www.windows2000.tk

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,520 posts
  • Joined 27-November 10
  • OS:XP Pro x86
  • Country: Country Flag

Or see if redirection BEFORE line works

It works :) Thank you.

The full script itself got pretty long but here are main parts of it:


1. Unpacking files to HFMER folder.

IF EXIST HF\*.EXE (
	IF EXIST HFMER RD/Q/S HFMER
	IF EXIST TEMP RD/Q/S TEMP
	MD HFMER TEMP
	FOR /F %%I IN ('DIR/A-D/B HF') DO (
		ECHO.&ECHO Unpacking %%I
		MD TEMP\HFMER&START/WAIT HF\%%I /Q /X:TEMP\HFMER
		ECHO.
		XCOPY/DEHRY TEMP\HFMER HFMER
		ECHO.
		IF EXIST TEMP\HFMER\UPDATE\update.inf COPY/B TEMP\HFMER\UPDATE\update.inf TEMP\%%I.inf >NUL
		IF EXIST TEMP\HFMER\UPDATE\update_w2k.inf COPY/B TEMP\HFMER\UPDATE\update_w2k.inf TEMP\%%I.inf >NUL
		IF EXIST TEMP\HFMER\UPDATE\update_win2k.inf COPY/B TEMP\HFMER\UPDATE\update_win2k.inf TEMP\%%I.inf >NUL
		IF EXIST TEMP\HFMER\UPDATE\update.ver COPY/B TEMP\HFMER\UPDATE\update.ver TEMP\%%I.ver >NUL
		RD/Q/S TEMP\HFMER >NUL
	)


2. Merging update.ver

	:: merging update.ver
	CLS
	ECHO.&ECHO Merging update.ver...&ECHO.
	FOR /F %%A IN ('DIR/B TEMP\*.ver') DO (
		FOR /F "skip=1 tokens=*" %%B IN (TEMP\%%A) DO (
			ECHO TEMP\%%A -- %%B
			ECHO %%B >>TEMP\update.txt
		)
	)
		ECHO [SourceFileInfo] >TEMP\update.ver
		SORT TEMP\update.txt >>TEMP\update.ver
	:: removing duplicates in update.ver
		TOOLS\yanklines.vbs TEMP\update.ver HFMER\UPDATE\update.ver >NUL
I had to modify yanklines in order to prevent new cmd.exe windows from popping up. I modified this line

scriptCommand = "cmd.exe /k "
to
scriptCommand = "cmd.exe /c "
The window still pops up but gets closed instantly.


3. Merging update.inf by jaclaz's script & yanklines

	CLS
	ECHO.&ECHO Merging update.inf...&ECHO.
	COPY/B TOOLS\jaclaz\*.* >NUL
	COPY/B HFMER\update\update.inf update.inf >NUL
	splitinf.cmd update.inf >NUL
		:: yanklines SPLIT_update\*.inf
		XCOPY/EI SPLIT_update TEMP\SPLIT_update >NUL
			IF EXIST TEMP\SPLIT_update\[1ndex]update.inf DEL/Q TEMP\SPLIT_update\[1ndex]update.inf >NUL
			IF EXIST TEMP\SPLIT_update\*Add.Reg*]update.inf DEL/Q TEMP\SPLIT_update\*Add.Reg*]update.inf >NUL
			IF EXIST TEMP\SPLIT_update\*AddReg*]update.inf DEL/Q TEMP\SPLIT_update\*AddReg*]update.inf >NUL
			IF EXIST TEMP\SPLIT_update\[Strings]update.inf DEL/Q TEMP\SPLIT_update\[Strings]update.inf >NUL
		FOR /F %%I IN ('DIR/B TEMP\SPLIT_update') DO (
			START/WAIT TOOLS\yanklines.vbs TEMP\SPLIT_update\%%I SPLIT_UPDATE\%%I >NUL
		)
	join_dedupe_inf.cmd SPLIT_update.inf >NUL
	beautify.cmd JOINED_update.inf >NUL
	MOVE/Y BEAUTY_JOINED_update.inf HFMER\update\update.inf >NUL

	DEL/Q update.inf splitinf.cmd join_dedupe_inf.cmd beautify.cmd fedit.exe gsar.exe split_update.inf joined_update.inf >NUL
	RD/Q/S SPLIT_update >NUL
	RD/Q/S TEMP >NUL
I know it's not ideal and many bypasses are used to make it work... but it does the job. Actually I've just noticed that deleting the *.inf files (look above) is not necessary anymore. They are related to CMSORT which I replaced with yanklines which is better and simpler, and what's the most important - it doesn't sort which is crucial in case of *Add*Reg* sections.

4. SP part - it's not finished yet and pretty long

Spoiler

The main points are:

- To remove all duplicate files from the original SP. A lot of files from ia/id/is/ip folders overlap each other. The method I use to dedupe them is to make new folders (iads, iadw, etc.) and move shared files according to the edition of 2K they are related to. After that the update.inf has to be changed too (this part is not ready yet).

- Replace installer files with the ones from Gurgelmeyer's USP5 which ignore M$ digital signatures.

- Update SP files with new versions. This is the most problematic part. First of all, it's easy to update files that are already in SP4. They can just be directly replaced and no changed to the update.inf are needed. The problem is with those files that do not originally belong to SP4. In order to add them, the update.inf has to be edited and it is complicated as it can't be done by just merging the update.inf from HFMER\update with the one from SP4. There are additional sections which are related to the /integrate switch ([ServicePackFiles], etc.) and new files must be placed there in order to get integrated. These sections are empty in normal (non-SP) updates. The other issue is that SP4's update.inf is old and its structure is a little different than update.infs from newer updates. By processing them by jaclaz's script many unnecessary and overlapping lines get inserted. The way to fix it would be to 'update' the SP4's update.inf to make it more similar to the newer ones. Some of the older updates are also affected by this issue. The same 'updating' thing probably must be done to the update.inf merged by the script. I'll have to work on it separately.

- New files (not belonging to the original SP4) are placed in a new folder (i386\SP6) to have them separated from the rest. They are also checked against the original W2K CD i386 files to know which of them can be compressed (makecab) and which not. Files which are not present either in SP4 or the 2K CD get copied to i386\SP6\new.

That's all for now. There are still many things to do, especially related to the merged update.inf file. I'm open to any ideas about how to change and what to improve in the script.

Edited by tomasz86, 05 August 2011 - 11:53 AM.

Posted Image
Unofficial Service Pack 5.2 for MS Windows 2000 <- use this topic if you need help with UURollup, Update Rollup 2 and other unofficial packages

#97
tomasz86

tomasz86

    www.windows2000.tk

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,520 posts
  • Joined 27-November 10
  • OS:XP Pro x86
  • Country: Country Flag
I have a problem and don't know how to solve it.

Why doesn't GOTO work here?

splitinf.cmd update.inf

GOTO :SP

There is no problem if the first line is disabled

REM splitinf.cmd update.inf

GOTO :SP

The script just does splitinf and stops... As far as I remember it worked before but now it doesn't :} There are no errors on the screen. It behaves as it there was EXIT after the splitinf line.

Edited by tomasz86, 06 August 2011 - 08:32 AM.

Posted Image
Unofficial Service Pack 5.2 for MS Windows 2000 <- use this topic if you need help with UURollup, Update Rollup 2 and other unofficial packages

#98
bphlpt

bphlpt

    MSFN Addict

  • Member
  • PipPipPipPipPipPipPip
  • 1,798 posts
  • Joined 12-May 07
  • OS:none specified
  • Country: Country Flag
In a rush right now so don't have time to look up the syntax, but try executing the first line through a CALL statement. That should force return to execute the next line.

Cheers and Regards

Edited by bphlpt, 06 August 2011 - 11:40 AM.

Posted Image


#99
tomasz86

tomasz86

    www.windows2000.tk

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,520 posts
  • Joined 27-November 10
  • OS:XP Pro x86
  • Country: Country Flag
It works :thumbup
Posted Image
Unofficial Service Pack 5.2 for MS Windows 2000 <- use this topic if you need help with UURollup, Update Rollup 2 and other unofficial packages

#100
ricktendo

ricktendo

    Group: Banned Members

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,307 posts
  • Joined 06-June 06
  • OS:Windows 7 x64
  • Country: Country Flag
INF UpdateInis is perfect for this

Tell me the path+name the file I can give you some examples

UpdateIniFields

[update-inifields-section-name]
ini-file, ini-section, profile-name,(old-field), (new-field),(flags)

Replaces, adds, and deletes fields in the value of a given INI entry. Unlike the Update INI File section
type, this type of section replaces, adds, or deletes portions of a value in an INI file entry rather than the
whole value. The section name, update-inifields-section-name, must appear in the UpdateIniFields item
in an Install section of the INF file.

ini-file
Name of the INI file containing the entry to change. For more information about specifying the INI
filename, see the topic that describes the Update INI File section type.

ini-section
Name of the INI file section containing the entry to change.

profile-name
Name of the entry to change.

old-field
Field value to delete.

new-field
Field value to add, if not already there.

flags
Specifies whether to treat the old-field and new-field parameters as if they have a wild card character or
not and/or what separator character to use when appending a new field to an INI file entry. Can be any
of these values:

Value Meaning
0 (Default) Treat "*" character literally when matching fields, and not as a wild card
character. Use blank (" ") as a separator when adding a new field to an entry.
1 Treat "*" character as a wild card character when matching fields. Use blank (" ") as a
separator when adding a new field to an entry.
2 Treat "*" character literally when matching fields, and not as a wild card character. Use
comma (",") as a separator when adding a new field to an entry.
3 Treat "*" character as a wild card character when matching fields. Use comma (",") as a
separator when adding a new field to an entry.

Any comments in the INI file line are removed as they might not be applicable after changes. When
looking for fields in the line in the INI file, spaces, tabs and commas are used as field delimiters.
However, a space is used as the separator when the new field is appended to the line.


Edited by ricktendo64, 06 August 2011 - 11:20 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN