• What are batch (.bat) files?

    Batch programs are stored in batch files. These are ascii files whose extension is ``.bat'' or ``.cmd''. They contain instructions for the operating system. When you execute such a file (you need not type the .bat or .cmd extension if this is unambiguous), it is as if you issued those instructions in your window (or MS-DOS prompt). It is useful to use such files to store a set of related commands that you want to use frequently. E.g., for this class, you might want to prepare a batch file containing the sequence

    	@rem My homework batch file
    	echo -- Processing Homework Batch File --
    	@rem "tasm" is the Turbo Assembler program
    	tasm /zi /z hw.asm
    	@rem File "hw.obj" is produced by the assembler
    	@rem "tlink" is the linker program
    	tlink /v hw.obj
    	@rem "hw.exe" is the result of linking hw.obj
    	hw.exe
    	echo -- Done Homework Batch File --
    
    Some general commands are: Note: you could also prepend these commands with the "@" symbol. Thus "@echo" and "echo" works equally.

    CUSTOMIZING YOUR WORK HABITS

    Suppose you have installed the GVIM editor in the directory C:\PROGS\VIM\GVIM54 and the executable is called "gvim.exe". You want to be able to invoke this GVIM from any directory, just by calling "vi". (Of course, the instructions here works if you want to invoke your Java compiler by conveniently by typing "jc", for example).
    -- Assume that in your standard search path, you have the directory C:\MyDirectory\bin where you put all your personal executable files.
    -- You can put a text file called "vi.bat" into C:\MyDirectory\bin which contains only one line:
    C:\PROGS\VIM\GVIM54\gvim.exe "%1"
    Now, from any directory, you can issue to your command window the following command
    vi MyFile.txt
    to invoke GVIM to edit your file "MyFile.txt". Note that "%1" is replaced by the first argument of the "vi".