Login or Sign Up to become a member!
LessThanDot Sit Logo

LessThanDot

Community Wiki

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot friendfeed Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Navigation

Google Ads

Combine Two Files (Concatenate)

From Wiki

Jump to: navigation, search

You can combine two or more files by reading in the files and then writing out to a combined file using the FileSystemObject, or you can use DOS.

  1. Set oWSH = CreateObject("WScript.Shell")
  2.     oWSH.Run ("%comspec% /c copy c:\docs\test1.txt+c:\docs\test2.txt c:\docs\test3.txt")


An Explanation

If test1.txt is:
abc 'no return character

... and test2.txt is:
def

... test3.txt will be:
abcdef 'eof

If test1.txt is:
abc 'with a return character

... test3.txt will be:
abc
def 'eof

"ComSpec (or %COMSPEC% ) is one of the environment variables used in MS-DOS and Microsoft Windows, which normally points to the command line interpreter, ..." (http://en.wikipedia.org/wiki/ComSpec)

Further Information

DOS Copy: http://www.easydos.com/copy.html

565 Rating: 1.0/5 (2 votes cast)