home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
utility
/
pbaseiv.zip
/
P4UTL005.TIP
< prev
next >
Wrap
Text File
|
1991-12-16
|
3KB
|
83 lines
I'm a Windows fan, but I miss having a DOS prompt
immediately available. When I need to type an ASCII file or
list a directory, I use a Turbo Pascal program, ONESHOT.PAS
[see listing]. The program works like Program Manager's and
File Manager's RUN options but is easier to use and
recognizes built-in DOS commands like DIR and COPY.
[A compiled, ready-to-run version of this program,
ONESHOT.EXE, is included in the P4UTIL directory on your
PowerBase *.* Volume IV diskette. If you want to modify the
program, copy the listing below to a .PAS file by pressing
the Alt-F key.]
C. D. Pirkey
St. Louis, Missouri
Editor's note: Although you can open a DOS Prompt window to
issue DOS commands, that window will stay open until you
close it. ONESHOT is ideal for any once-and-done DOS
command.
I added several extensions to Mr. Pirkey's original
submission. Like COMMAND.COM and the PROMPT $P$G command,
ONESHOT displays the current directory within the command
prompt. A double greater-than symbol (>>) reminds you that
this is not the usual DOS prompt. After you type a response,
ONESHOT executes built-in DOS commands directly. For other
commands, ONESHOT searches the current PATH for a COM file,
an EXE file, or a BAT file, in that order. You can override
this search order by including the file name's
extension--MYPROG.EXE, for example.
After compiling ONESHOT with Turbo Pascal 5.5 or 6.0, open
File Manager, locate ONESHOT.EXE, and drag it to a Program
Manager group window. To use ONESHOT, select its icon and
type any DOS command or program name at the resulting
prompt. After the command finishes, ONESHOT reports the
current DOS error- and exit-code values, or `0' if no
problems were detected. Press <Enter> to return to Windows.
If ONESHOT's window stays visible, press <Alt>-<F4> to close
it, start the Windows PIF Editor, open _DEFAULT.PIF, and
then check the box labeled `Close Window on Exit'. After you
have made this change, ONESHOT's window will disappear
automatically.
Postscript: The original program published with this tip was
considerably longer than the one included here, and had
several bugs. (For instance, it converted your command to
all uppercase -- which might cause it to fail -- and claimed
to return the DOS error level for a program when in fact it
did not. Also, it missed some internal commands that are now
part of some versions of DOS.) This one is much smaller and
simpler, and no longer tries to report the DOS error and
exit codes, but it does what it says it does correctly.
ONESHOT.PAS
---- BEGIN LISTING ----
{$M $2000,0,0 }
program OneShot;
uses dos;
var
command : string;
begin
getdir(0, command);
write(command, '>>');
readln(command);
swapvectors;
exec(getenv('COMSPEC'), '/C ' + command);
swapvectors;
write(#13#10'Press <Enter> to return to Windows. ');
readln
end.
---- END LISTING ----
Title: One-Shot DOS Prompt for Windows
Category: MISC
Issue date: Apr 1991
Editor: Tom Swan
Supplementary files: P4UTIL\ONESHOT.EXE