MSFN Forum: How to merge two text files? - MSFN Forum

Jump to content


  • 12 Pages +
  • « First
  • 2
  • 3
  • 4
  • 5
  • 6
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

How to merge two text files? and sort them... Rate Topic: -----

#61 User is offline   tomasz86 

  • http://www.windows2000.tk
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,220
  • Joined: 27-November 10
  • OS:Windows 2000 Professional
  • Country: Country Flag

Posted 16 July 2011 - 04:17 AM

Thank you :wub: I know it's still the very alpha stage of your script but if it can be utilised even now then why not? ;)

By using it I can check if I merged everything correctly in Update Rollup 2 for example. It can also be used to remove all the unnecessary spaces and reduce the size of the update.inf file.

I'll try to prepare such a difficult update.inf and upload it for you.

I also have an another question: Is it possible to select sections that I would like to merge?

For example, I want to merge only these sections

[Save.Reg.For.Uninstall]
[Product.Del.Reg]
[Product.Add.Reg]


Nevermind, I got it. You can select them from the SPLIT_XXX folder after doing splitinf.

btw, what are the two pauses in splitinf for?

Your script is quite CPU hungry :lol: It uses both cores of an Athlon II x2 250 at >60%.

This post has been edited by tomasz86: 16 July 2011 - 04:25 AM



#62 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,420
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 16 July 2011 - 11:21 AM

Hopefully fixed:
  • the "<=" and "=>" issues
  • the [TAB] issue
  • the two PAUSE (leftover from tests)


I don't think the batch is particularly CPU hungry, I presume is the "normal" problem with CMD.EXE (or if you prefer Command Prompt).

On my PC running split_inf.cmd raises cpu's usage to around 40%, with peak at around 55%

The poorman's way for similar problems has been traditionally that of editing the settings in the \Windows\_default.pif, but cannot really say if it affects "pure batch" execution. :unsure: (and anyway it rarely does *much* difference)

You may want to experiment with ;):
http://mion.faireal.net/BES/


jaclaz

Attached File(s)


This post has been edited by jaclaz: 16 July 2011 - 11:54 AM


#63 User is offline   tomasz86 

  • http://www.windows2000.tk
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,220
  • Joined: 27-November 10
  • OS:Windows 2000 Professional
  • Country: Country Flag

Posted 17 July 2011 - 08:22 AM

"Echo is off." still present ;)

update.inf

#64 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,420
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 17 July 2011 - 09:24 AM

View Posttomasz86, on 17 July 2011 - 08:22 AM, said:

"Echo is off." still present ;)

update.inf

Not here :w00t: , using on the above file splitinf.cmd dated 16/07/2011, I can find no "ECHO" in any of the files in the "SPLIT_" directory.
Nor, after having used join_dedupe_inf.cmd dated 15/07/2011 in the "JOINED_" .inf.

BUT there was a problem (NOT related to the ECHO) in beautify.cmd (forgot a few x's, my bad :blushing: )

Find atttached the SAME splitinf.cmd and join_dedupe_inf.cmd with a corrected beautify.cmd

Try again.

jaclaz

Attached File(s)



#65 User is offline   tomasz86 

  • http://www.windows2000.tk
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,220
  • Joined: 27-November 10
  • OS:Windows 2000 Professional
  • Country: Country Flag

Posted 21 July 2011 - 04:20 AM

I haven't prepared the update.inf yet but I have some information about deduping sections.

Generally, all [*.files] sections can be deduped without any problems.

[SourceDisksNames] & [SourceDisksFiles] can be also deduped.

As for the strings I wrote about a few days ago it's like this:

The basic structure:
[Save.Reg.For.Uninstall]

    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%SP_SHORT_TITLE%
    HKLM,SOFTWARE\Microsoft\Updates\Windows 2000\SP%SERVICE_PACK_NUMBER%\%SP_SHORT_TITLE%

[Product.Add.Reg]

    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%SP_SHORT_TITLE%,"Installed",0x10001,1
    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%SP_SHORT_TITLE%,"Comments",0,%SP_TITLE%
    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%SP_SHORT_TITLE%,"Backup Dir",0,""
    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%SP_SHORT_TITLE%,"Fix Description",0,%SP_TITLE%
    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%SP_SHORT_TITLE%,"Installed By",0,""
    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%SP_SHORT_TITLE%,"Installed On",0,""
    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%SP_SHORT_TITLE%,"Service Pack",0x10001,%SERVICE_PACK_NUMBER%
    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%SP_SHORT_TITLE%,"Valid",0x10001,1
    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%SP_SHORT_TITLE%\File 1\,"Flags",0,""
    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%SP_SHORT_TITLE%\File 1\,"New File",0,""
    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%SP_SHORT_TITLE%\File 1\,"New Link Date",0,""
    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%SP_SHORT_TITLE%\File 1\,"Old Link Date",0,""
    HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%SP_SHORT_TITLE%,"ReleaseType",0,Hotfix
    HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%SP_SHORT_TITLE%,"RegistryLocation",0,"HKLM\SOFTWARE\Microsoft\Updates\Windows 2000\SP%SERVICE_PACK_NUMBER%\%SP_SHORT_TITLE%"
    HKLM,SOFTWARE\Microsoft\Updates\Windows 2000\SP%SERVICE_PACK_NUMBER%\%SP_SHORT_TITLE%,"Description",,%SP_TITLE%
;   Plugin.ocx
    HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%SP_SHORT_TITLE%","DisplayIcon",0x00020000, "%windir%\System32\msiexec.exe"


Without any loss of necessary data it can be reduced to
[Save.Reg.For.Uninstall]

    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%SP_SHORT_TITLE%
    HKLM,SOFTWARE\Microsoft\Updates\Windows 2000\SP%SERVICE_PACK_NUMBER%\%SP_SHORT_TITLE%

[Product.Add.Reg]

    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%SP_SHORT_TITLE%,"Installed",0x10001,1


This line
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%SP_SHORT_TITLE%","DisplayIcon",0x00020000, "%windir%\System32\msiexec.exe"


should be reduced and go to both [Save.Reg.For.Uninstall] & [Product.Del.Reg].

Final thing should look like this:
[Save.Reg.For.Uninstall]

    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%SP_SHORT_TITLE%
    HKLM,SOFTWARE\Microsoft\Updates\Windows 2000\SP%SERVICE_PACK_NUMBER%\%SP_SHORT_TITLE%
    HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%SP_SHORT_TITLE%

[Product.Del.Reg]

    HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%SP_SHORT_TITLE%

[Product.Add.Reg]

    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%SP_SHORT_TITLE%,"Installed",0x10001,1


Finally, SP%SERVICE_PACK_NUMBER% should be changed to SP5 (all Win2k updates after SP4 are listed as SP5).

So if we add ex. KB123456 it should be
[Save.Reg.For.Uninstall]

    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\KB123456
    HKLM,SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB123456
    HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KB123456

[Product.Del.Reg]

    HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KB123456

[Product.Add.Reg]

    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\KB123456,"Installed",0x10001,1


The line
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KB123456

in [Product.Del.Reg] is necessary to remove KB123456 from the list of installed updates.

On the other hand,
HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\KB123456,"Installed",0x10001,1

is needed to tell Windows Updates that KB123456 is installed.

Is is also important to note that the basic structure I put above is also needed but in the case of a merged update it will be related to the name of the merged update, not the updates included in it.

I'll give an example. Let's say we merge two updates - KB123456 & KB234567. The merged info should be
[Save.Reg.For.Uninstall]

    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\KB123456
    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\KB234567
    HKLM,SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB123456
    HKLM,SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB234567
    HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KB123456
    HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KB234567

[Product.Del.Reg]

    HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KB123456
    HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KB234567

[Product.Add.Reg]

    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\KB123456,"Installed",0x10001,1
    HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\KB234567,"Installed",0x10001,1


I hope you understand what I mean. Please tell me if my explanation is unclear or too complicated ;)

This post has been edited by tomasz86: 21 July 2011 - 04:20 AM


#66 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,420
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 21 July 2011 - 05:04 AM

View Posttomasz86, on 21 July 2011 - 04:20 AM, said:

I hope you understand what I mean. Please tell me if my explanation is unclear or too complicated ;)

Yes/no. :ph34r:

As I see it it is out of "current scope". :whistle:

All that seems to me like something that may be "post-processed". (and consequently to be tackled later, ONCE we have "basic" functionalities working).

Current scope (as I see it) is to "consolidate" and "merge" whatever is in the "source" files into a "monolithic" file with NO CHANGES to the contents WHATSOEVER (apart removing crazy blank spaces and [TAB]'s).

jaclaz

#67 User is offline   tomasz86 

  • http://www.windows2000.tk
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,220
  • Joined: 27-November 10
  • OS:Windows 2000 Professional
  • Country: Country Flag

Posted 21 July 2011 - 06:39 AM

I see ;)

So far I haven't seen any other problems connected with merging. I used your script to merge many update.inf files from Win2k updates and everything seems to work fine unless the update.inf itself has different structure (ex. IE/OE updates or WMP updates are different).

This post has been edited by tomasz86: 21 July 2011 - 06:39 AM


#68 User is offline   tomasz86 

  • http://www.windows2000.tk
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,220
  • Joined: 27-November 10
  • OS:Windows 2000 Professional
  • Country: Country Flag

Posted 21 July 2011 - 08:27 PM

I found a freeware program called CMSort which is able to sort files and remove duplicates from them.

cmsort.exe /D 1.txt 1.sor


The problem is that the file has to be specified, i.e. it doesn't seem possible to use it for multiple files at once.

I wonder if it is possible to modify your script to have it sort all files in %Split_dir% one by one as they are created.

EDIT

Once again I tried to use the HFSLIP string mentioned in the beginning of this topic

@ECHO OFF
IF EXIST SPLIT_update\*.inf (
	MD SPLIT_update\CMSORT
	DIR/B/A-D/OGN/ON SPLIT_update\*.inf>CMSORT.TXT
	SET CMSORT=
	FOR /F %%I IN (CMSORT.TXT) DO (SET CMSORT=%%I&IF DEFINED CMSORT CALL :CMSORT)
	DEL/Q/S CMSORT.TXT
)
IF NOT EXIST SPLIT_update\*.inf (
	EXIT
)

:CMSORT
cmsort /D /H=2 SPLIT_update\%CMSORT% SPLIT_update\CMSORT\%CMSORT%
xcopy/Y SPLIT_update\CMSORT\%CMSORT% SPLIT_update\
ECHO.

IF NOT EXIST CMSORT.TXT (
	RD/Q/S SPLIT_UPDATE\CMSORT
)


The only problem is that [1ndex]update.inf should be excluded from sorting as it contains list of sections in their original order.

EDIT

jaclaz,

there is strange line in KB918118, KB925902, KB926247, KB927891, KB928843, KB935839 for Win2k. In [Strings] the last line is

KODAK_DIR            =       "Windows NT\Accessories\ImageVue"@i:@u: [WatsonManifestMode.Cancel]

Because of this [Strings] & [WatsonManifestMode.Cancel] get mixed when processed by your script.

This post has been edited by tomasz86: 22 July 2011 - 01:01 AM


#69 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,420
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 22 July 2011 - 09:05 AM

View Posttomasz86, on 21 July 2011 - 08:27 PM, said:

The only problem is that [1ndex]update.inf should be excluded from sorting as it contains list of sections in their original order.

That is NOT a problem, add:

Quote

:CMSORT
IF "%CMSORT%"=="[1ndex]update.inf" GOTO :EOF
cmsort /D /H=2 SPLIT_update\%CMSORT% SPLIT_update\CMSORT\%CMSORT%
xcopy/Y SPLIT_update\CMSORT\%CMSORT% SPLIT_update\
ECHO.

IF NOT EXIST CMSORT.TXT (
RD/Q/S SPLIT_UPDATE\CMSORT
)


Still waiting for the "fake" problematic .inf .... :whistle:

jaclaz

#70 User is offline   tomasz86 

  • http://www.windows2000.tk
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,220
  • Joined: 27-November 10
  • OS:Windows 2000 Professional
  • Country: Country Flag

Posted 22 July 2011 - 10:20 AM

Actually I haven't found any other problems except this one

KODAK_DIR            =       "Windows NT\Accessories\ImageVue"@i:@u: [WatsonManifestMode.Cancel]

which I mentioned above :)

#71 User is offline   tomasz86 

  • http://www.windows2000.tk
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,220
  • Joined: 27-November 10
  • OS:Windows 2000 Professional
  • Country: Country Flag

Posted 23 July 2011 - 01:50 AM

An emty file "2.53" gets created because of this line:

; These files are installed even if MDAC > 2.53 is present.

It's just an explanatory note I wrote.

This line

HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","Plus! ProductId"

is changed to

HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","Plus ProductId"

"!" is gone.

Also this update.inf has many informative strings starting with ; and it gets messed pretty badly after running your script ;)

This post has been edited by tomasz86: 23 July 2011 - 02:23 AM


#72 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,420
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 26 July 2011 - 02:01 AM

View Posttomasz86, on 23 July 2011 - 01:50 AM, said:

Also this update.inf has many informative strings starting with ; and it gets messed pretty badly after running your script ;)

Try the attached.

jaclaz

Attached File(s)



#73 User is offline   tomasz86 

  • http://www.windows2000.tk
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,220
  • Joined: 27-November 10
  • OS:Windows 2000 Professional
  • Country: Country Flag

Posted 26 July 2011 - 08:48 AM

Thank you :) It seems to be OK now.

There is still this problem with [WatsonManifestMode.Cancel] which causes lines in [Strings] to be divided into two separate sections.

You can see it if you process this update.inf through your script.

BTW, I did this

:CMSORT
TOOLS\cmsort.exe /D /H=2 SPLIT_update\%CMSORT% SPLIT_update\CMSORT\%CMSORT%
IF EXIST SPLIT_update\CMSORT\[1ndex]update.inf DEL/Q SPLIT_update\CMSORT\[1ndex]update.inf 
IF EXIST SPLIT_update\CMSORT\*Add.Reg]update.inf DEL/Q SPLIT_update\CMSORT\*Add.Reg]update.inf
IF EXIST SPLIT_update\CMSORT\*AddReg]update.inf DEL/Q SPLIT_update\CMSORT\*AddReg]update.inf
xcopy/Y SPLIT_update\CMSORT\%CMSORT% SPLIT_update\
ECHO.

instead of

IF "%CMSORT%"=="[1ndex]update.inf" GOTO :EOF


Add.Reg sections also shouldn't be sorted and deduped as newer updates may update the older ones. After using CMSORT their order may be wrong.

This post has been edited by tomasz86: 26 July 2011 - 09:16 AM


#74 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,420
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 27 July 2011 - 02:17 AM

View Posttomasz86, on 26 July 2011 - 08:48 AM, said:

Thank you :) It seems to be OK now.

There is still this problem with [WatsonManifestMode.Cancel] which causes lines in [Strings] to be divided into two separate sections.

Try the attached.


View Posttomasz86, on 26 July 2011 - 08:48 AM, said:

Add.Reg sections also shouldn't be sorted and deduped as newer updates may update the older ones. After using CMSORT their order may be wrong.

And still this belongs to the actual merging command ( which is yet to be written).

jaclaz

Attached File(s)



#75 User is offline   tomasz86 

  • http://www.windows2000.tk
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,220
  • Joined: 27-November 10
  • OS:Windows 2000 Professional
  • Country: Country Flag

Posted 27 July 2011 - 03:54 AM

View Postjaclaz, on 27 July 2011 - 02:17 AM, said:

View Posttomasz86, on 26 July 2011 - 08:48 AM, said:

Add.Reg sections also shouldn't be sorted and deduped as newer updates may update the older ones. After using CMSORT their order may be wrong.

And still this belongs to the actual merging command ( which is yet to be written).

I know :) I was to talking in the relation to CMSORT in case someone else will use it to dedupe these sections.

#76 User is offline   tomasz86 

  • http://www.windows2000.tk
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,220
  • Joined: 27-November 10
  • OS:Windows 2000 Professional
  • Country: Country Flag

Posted 31 July 2011 - 07:46 AM

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.

This post has been edited by tomasz86: 31 July 2011 - 07:47 AM


#77 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,420
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 31 July 2011 - 09:15 AM

View Posttomasz86, on 31 July 2011 - 07:46 AM, said:

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 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,363
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 31 July 2011 - 09:43 AM

View Posttomasz86, on 31 July 2011 - 07:46 AM, said:

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 User is offline   tomasz86 

  • http://www.windows2000.tk
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,220
  • Joined: 27-November 10
  • OS:Windows 2000 Professional
  • Country: Country Flag

Posted 31 July 2011 - 09:50 AM

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.

This post has been edited by tomasz86: 31 July 2011 - 09:53 AM


#80 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,420
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 31 July 2011 - 10:03 AM

View Posttomasz86, on 31 July 2011 - 09:50 AM, said:

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.


View Posttomasz86, on 31 July 2011 - 09:50 AM, said:

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

This post has been edited by jaclaz: 31 July 2011 - 10:09 AM


Share this topic:


  • 12 Pages +
  • « First
  • 2
  • 3
  • 4
  • 5
  • 6
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy