Useful DOS Commands and QBASIC Functions

 

The floppy disk drive letters are a: or b: while drive letters c through z can be hard drives or CDROM drives. The following commands for Microsoft Disk Operating System allow wild cards ( * ), or question mark ( ? ).

 

The DOS prompt usually looks like the drive letter and a "greater than" sign.

 

C>  or A>

 

To get help use /?  After a command      ie: dir /?

 

To see the directory of files          dir      dir *.*    dir *.doc

 

To rename files                           ren oldname newname

 

To copy files                               copy filename c:newplace

 

To change directorys                   cd ..    Up one level

                                                  Cd \    up to the root level

                                                  Cd lowername

 

To make a directory                     mkdir newname

 

To delete a directory                    rmdir dirname

 

To delete a file                            del filename.ext

 

To type a file on the screen          type filename

 

To print to the printer port            print filename

 

To clear the screen                      cls

 

To fuss with the prompt                prompt $p $g   (prompt to clear)

 

                                                  Prompt $t      Gives current time

 

                                                  Prompt $d     Gives the date

To copy files and subdirectories    Xcopy

To see the version of system        ver

 

To exit DOS                                exit


QBasic Math Functions

 

BASIC or Qbasic is a DOS based programming language. If you are interested in this, see the instructor for more information.

 

SIN               GOSUB        IF…THEN…ELSE

COS             EXP              FOR…NEXT          

TAN              ATAN            INT               PRINTINPUT

RND             REM             DIM              PRINT USING

SQR             AND             OR               XOR             NOT

CLS              HEX$

 

For more, bring up Qbasic and press Shift+F1

To run a program …  Shift+F5

 

Example: Help printout for 'Print Using' command to make the numbers appear the way you want them to on output:

 

PRINT USING writes formatted output to the screen or to a file.

 

Example:

                    a = 123.4567

                    PRINT USING "###.##"; a

 

Characters that format a numeric expression

 

 #      Digit position.                                -      Placed after digit, prints

 .       Decimal point position.                                   trailing sign for negative

 ,       Placed left of the decimal point,             numbers.

         prints a comma every third digit.    $$    Prints leading $.

 +      Position of number sign.                 **    Fills leading spaces with *.

^^^^  Prints in exponential format.             **$  Combines ** and $$.

 

Characters used to format a string expression

 

 &   Prints entire string.                         \   \   Prints first n characters,

 !    Prints only the first character                   where n is the number of

      of the string.                                           blanks between slashes + 2.

 

 Characters used to print literal characters

 

_    Prints the following formatting                  Any character not in this

      character as a literal.                              table is printed as a

                                                                             literal.