The copy command can be very useful for quick operations. However, there are a number of tricks that are not widely known.
1) Copying the contents of a source directory into the current directory: just specify the source directory!
y:\privates>copy C:\WINDOWS\system32\clients\twclient\x86C:\WINDOWS\system32\clients\twclient\x86\twcli32.msi 1 file(s) copied.
2) Creating a text file without an editor:
y:\privates>copy con sample.txtThis is a text file.Another line...^Z 1 file(s) copied. y:\privates>type sample.txtThis is a text file.Another line...
y:\privates>copy con sample.txtThis is a text file.Another line...^Z 1 file(s) copied.
y:\privates>type sample.txtThis is a text file.Another line...
3) Creating a zero-size file
C:\>copy nul empty.txt 1 file(s) copied. C:\>dir empty.txt Volume in drive C has no label. Volume Serial Number is FCCD-E1D0 Directory of C:\ 02/26/2005 10:38 PM 0 empty.txt 1 File(s) 0 bytes 0 Dir(s) 24,429,268,992 bytes free
C:\>copy nul empty.txt 1 file(s) copied.
C:\>dir empty.txt Volume in drive C has no label. Volume Serial Number is FCCD-E1D0
Directory of C:\
02/26/2005 10:38 PM 0 empty.txt 1 File(s) 0 bytes 0 Dir(s) 24,429,268,992 bytes free
4) Appending to a text file. Note that /A flag
y:\privates>copy /A abc.txt + conabc.txtconBBB^Z 1 file(s) copied. y:\privates>copy /A abc.txt + conabc.txtconCCC^Z 1 file(s) copied. y:\privates>type abc.txtAAABBBCCC
y:\privates>copy /A abc.txt + conabc.txtconBBB^Z 1 file(s) copied.
y:\privates>copy /A abc.txt + conabc.txtconCCC^Z 1 file(s) copied.
y:\privates>type abc.txtAAABBBCCC
[update: item (3) above is fixed now.]