内容 †
ファイルをコピーする。
使用方法 †
md [<Drive>:]<Path> mkdir [<Drive>:]<Path>
オプション †
オプション | 説明 |
/d | 複製される暗号化されたファイルが、複製先で復号されて保存されることを許可する |
/v | ファイルが正しく書き込みされていることを検査する |
/n | MS-DOS形式以外の名前のファイルをコピーするときに、利用可能ならば短いファイル名を使用する。MS-DOSは8+3形式 |
/y | 上書き時に確認メッセージを表示しない |
/-y | 上書き時に確認メッセージを表示する |
/z | ネットワーク経由でのファイルコピーに失敗した場合、コピーを再開する |
/a | ASCII テキストファイルとして扱う。EOFはCtrl+Zとみなし、コピーしたファイルの終わりにはCtrl+Zを加える。 |
/b | バイナリファイルとして扱う。 |
/l | シンボリックリンクの場合、実際のファイルでなくリンク自体を複製する |
<Source> | 複製元 |
<Destination> | 複製先 |
使用例 †
ファイルをコピーする †
C:\Users\Administrator\dos>md parent\child C:\Users\Administrator\dos>dir /s parent ドライブ C のボリューム ラベルがありません。 ボリューム シリアル番号は 0A12-47B4 です C:\Users\Administrator\dos\parent のディレクトリ 2019/03/02 14:12 <DIR> . 2019/03/02 14:12 <DIR> .. 2019/03/02 14:12 <DIR> child 0 個のファイル 0 バイト C:\Users\Administrator\dos\parent\child のディレクトリ 2019/03/02 14:12 <DIR> . 2019/03/02 14:12 <DIR> .. 0 個のファイル 0 バイト ファイルの総数: 0 個のファイル 0 バイト 5 個のディレクトリ 296,915,824,640 バイトの空き領域
複数のファイルをコピーする †
複数のファイルをコピーして1つのファイルにする
c:\test>echo "hello" > hello.txt c:\test>echo "world" > world.txt c:\test>copy hello.txt + world.txt hello-world.txt hello.txt world.txt 1 個のファイルをコピーしました。 c:\test>type hello-world.txt "hello" "world" c:\test>copy /-y hello.txt + world.txt hello-world.txt hello.txt hello-world.txt を上書きしますか? (Yes/No/All): Yes world.txt 1 個のファイルをコピーしました。 c:\test>copy /y hello.txt + world.txt hello-world.txt hello.txt world.txt 1 個のファイルをコピーしました。
ワイルドカード*を使うこともできる。
c:\test>copy /b *.txt hello-world.txt hello.txt world.txt 1 個のファイルをコピーしました。 c:\test>type hello-world.txt "hello" "world" c:\test>hello-world.txt c:\test>copy /a *.txt hello-world.txt hello-world.txt hello.txt world.txt 1 個のファイルをコピーしました。 c:\test>hello-world.txt c:\test>type hello-world.txt "hello" "world" "hello" "world"
実体ではなくシンボリックリンクをコピーする †
c:\test>mklink alias hello-world.txt alias <<===>> hello-world.txt のシンボリック リンクが作成されました c:\test>type file1.txt "hello" "world" "hello" "world" c:\test>copy /L alias file.lnk 1 個のファイルをコピーしました。 c:\test>dir ドライブ C のボリューム ラベルがありません。 ボリューム シリアル番号は 7241-A2C2 です c:\test のディレクトリ 2019/03/06 01:11 <DIR> . 2019/03/06 01:11 <DIR> .. 2019/03/06 01:09 <SYMLINK> alias [hello-world.txt] 2019/03/06 01:09 <SYMLINK> file.lnk [hello-world.txt] 2019/03/06 01:06 41 file1.txt 2019/03/06 01:06 41 hello-world.txt 2019/03/06 01:00 10 hello.txt 2019/03/06 01:00 10 world.txt 6 個のファイル 102 バイト 2 個のディレクトリ 37,632,450,560 バイトの空き領域