CSCI 1300 Computer Science 1: Programming
Spring 2004
Karl Winklmann
|
|
MSDOS Commands |
|
Here are some useful commands.
Example Effect mkdir 1300project create a new directory cd 1300project change to a directory cd .. change to "parent" directory d: change drive copy main.cxx assign2.cxx copy a file ren Makefile.txt Makefile change name more r.bat scroll through file del main.exe delete a file dir list directory contents tree /f show directory and subdirectories and files help tree get information about a command dir | more the 'more' presents the output one screenful at a time
Very useful, you can put a list of commands into a file and then execute those commands by typing the file name. The file extension needs to be "BAT", short for "batch". For example, if R.BAT contains
if EXIST main.exe DEL main.exe if EXIST main.o DEL main.o g++ -g -c -Wall main.cxx bgi++ -o main.exe main.o if EXIST main.exe main
then simply typing R will recompile and (if no compilation errors occurred) run your newly compiled program main. The first two lines delete main.o and main.exe so that in case of compilation errors you don't end up executing the old main. The "if EXIST" part avoids error messages if the file to be deleted does not exist. [The second line was added after this page was first posted.]
| © 2004 Karl Winklmann | 5:53 PM, Thursday, April 29, 2004 |