home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
batutl
/
batcd.doc
< prev
next >
Wrap
Text File
|
1992-09-08
|
2KB
|
45 lines
This program allows a batch file to change directories (just
like the CD command), but to read the new directory from the
"standard input file" instead of the command line.
The command:
bat-cd reads new directory from keyboard
bat-cd < file reads new directory from "file"
bat-cd <file >nul no display of new dir name when changing
You can use the directory changer to change back to the directory a
batch file started out with, such as when doing a spelling correction
or fancy font printing.
.
. (your batch file to do fancy font from any directory)
.
echo off
cd > \bin\bat\starting.dir saves initial directory
copy %1 \fancyfnt\temp/v make file local to pfont dir
cd \fancyfnt go to pfont dir
pfont +fi temp +fo romn12 (etc.) do printing
del temp get rid of local file copy
bat-cd <\bin\bat\starting.dir >nul return to user's directory
echo on
If you were going to, for example, a speller directory, which made
changes to the file, then you would copy the local file back before
changing directories back:
echo off
cd >\bin\bat\starting.dir save initial directory
copy %1 \speller\temp.txt/v make your file local
cd \speller
spellit temp.txt
bat-cd <\bin\bat\starting.dir >nul change back to user's dir
copy \speller\temp.txt %1/v copy spelling corrected file
del \speller\temp.txt back & delete other copy
echo on
Note that the new input is read as a single line, without any prompt,
followed by a carriage return. If the input is not a valid directory,
then the message "path not found" is placed on the standard output
file (console, but redirectable if one wishes).