DOS - File

> Procedural Languages > Dos (Win32 Shell Scripting) and Utilities

1 - About

File in DOS.

Advertising

3 - Management

3.1 - Create

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

in a for loop:

  • the file name without extension.
%%~nf
  • Fully Qualified Path Name
%~fI

3.3 - Change Attribute

3.4 - IF Exist

3.5 - Delete

del myFile.txt

See:

Advertising

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:
set PATHEXT=%PATHEXT%;.PY
assoc .py=Python.File
ftype Python.File=c:\Python27\python.exe "%1" %*

where:

Advertising
lang/dos/file.txt ยท Last modified: 2018/11/25 15:29 by gerardnico