DOS - File

1 - About

File in DOS.

3 - Management

3.1 - Create

3.2 - File Attribute (name, path, ...)

in a for loop:

  • the file name without extension.
  • Fully Qualified Path Name

3.3 - Change Attribute

3.4 - IF Exist

3.5 - Delete

del myFile.txt


  • ERASE Deletes one or more files.
  • DOS - DEL

3.6 - Rename

rename myFile.txt myRenameFile.txt

3.7 - Display the content

TYPE filename

type will display the contents of a text file or files.

3.8 - Re-assigning file ownership

takeown /?

3.9 - Concatenate two files

By using the type command and the redirections operators, you can concatenate files.

Example that add the content of file1.txt in file2.txt

type file1.txt >> file2.txt

3.10 - Compare

See fc Compares two files or sets of files, and displays the differences between them.

3.11 - File Association

How to create:

  • Example with Python:
assoc .py=Python.File
ftype Python.File=c:\Python27\python.exe "%1" %*


3.12 - Copy

3.12.1 - Directory

Recursively with xcopy (a better version of copy)

xcopy C:\source D:\target\path /s /e /h /y


  • s copies all sub directory (not the empty one)
  • e copies also the empty directory
  • h copies also hidden files
  • y don't prompt to override

See for details over the options

Data Science
Data Analysis
Data Science
Linear Algebra Mathematics

Powered by ComboStrap