Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combine two files 1

Status
Not open for further replies.

orna

Programmer
Apr 2, 2002
314
IL
I need to add the content of a text file to another text file.
like in Basic : copy c:\a.bkp+c:\b.txt c:\a.bkp
Is there a way to do it in one command?

TIA
 
You could:

Code:
Set oWSH = CreateObject("WScript.Shell")
oWSH.Run ("%comspec% /c copy c:\docs\test1.txt+c:\docs\test2.txt c:\docs\test3.txt")
 
Thanks Remou
What it means %comspec%
 
ComSpec (or %COMSPEC% ) is one of the environment variables used in MS-DOS and Microsoft Windows, which normally points to the command line interpreter, ..."

-- en.wikipedia.org/wiki/ComSpec

If test1.txt is:
[tt]abc[/tt] 'no return character

and test2.txt is:
[tt]def[/tt]

test3.txt will be:
[tt]abcdef[/tt] 'eof

If test1.txt is:
[tt]abc[/tt] 'with a return character

test3.txt will be:
[tt]abc
def[/tt] 'eof
 
Thank you for the explanation.
It works great!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top