Surviving DOS

Here’s the basic set of commands you’ll need to survive the Windows Command Prompt.

Moving between directories

The cd (change directory) command is used to move from one directory to another:

cd <Target directory>

Move to a directory called Python34:

cd Python34

Move to the root directory of the current drive (Win):

cd \

Move to the root directory of this drive (Linux/OSX):

cd / Move up one directory.

For example, from c:\users\mika to c:\users:

cd ..

Move from the current directory – for example c:\Python34 – to the directory c:\users\mika:

cd \users\mika

To move from one drive to another, simply type the drive letter followed by a colon:

x:

Copying files

You can copy files from one folder to another using the copy command:

copy <source file> <target file> <optional parameters>

To copy a file called helloworld.py from the directory c:\Tilap to the directory x:\omat-tiedostot:

copy c:\Tilap\helloworld.py x:\omat-tiedostot\

To create another copy of helloworld.py named helloworld-backup.py inside the same directory:

copy helloworld.py helloworld-backup.py

To copy a file called ohjelma.py from the directory x:\omat-tiedostot to the directory x:\Tilap, and to overwrite files with the same name in the target directory:

copy x:\omat-tiedostot\ohjelma.py c:\Tilap\ /Y

Removing files

You can remove files using the del command:

del <target file(s)> <optional parameters> 

To remove a file called test.py in the current directory:

del test.py 

To remove a file called test.py in the directory c:\users\mika:

del c:\users\mika\test.py 

To remove all files in the current directory:

del *.*

Some of the above in video format

Leave a Reply

Your email address will not be published. Required fields are marked *