home *** CD-ROM | disk | FTP | other *** search
- ==============
- SET PATH 1.0
- ==============
-
- Programmer
- Scott Burkhalter
- 723 S. Main St. Apt #1
- Ann Arbor, MI
- 48104-2953
-
-
- DISCLAIMER
- ==========
-
- This program is hearby released into the Public Domain, for use by
- whomever deems it useful. There is no Implied Warrenty or Customer
- Support. If it doesn't work on your 'puter, delete it.
-
-
- DISTRIBUTION
- ============
-
- If you distribute this program, please include all the files. It's pretty
- useless without the SETPATH.BAT file, for instance. There's some bug in
- Quick Pascal 1.0 which won't allow you to set environment variables from
- within an executable, so the batch file must do the actual path setting.
- I don't believe that this is too much of a hassle, as the required batch
- file is quite small.
-
- If you don't like typing in a 7 letter filename, feel free to rename the
- batch file anything you want.
-
-
- EXECUTION
- =========
-
- First, copy the SETPATH.BAT & SETPTH10.EXE programs a directory found in
- your path. ( usually C:\DOS or C:\UTILS or C:\BIN )
-
- To use SETPATH, type SETPATH (or whatever you renamed it to) at the DOS
- prompt, and hit return. The editing keys that are available when the
- program is running are displayed on the bottom of the screen. Pressing
- RETURN exits the edit mode, and SETPATH will ask you if you want to keep
- the changes that you made. If you do want to keep the changes, press
- the 'Y' key. If you don't want to keep the changes, press 'N' key.
-
- Type path at your DOS prompt to see if the changes actually occured at the
- DOS level.
-
-
- TECH NOTES
- ==========
-
- If anybody out there understands why Quick Pascal won't let you change
- environment variables from within a program, write me. I would like to
- discuss the issue with whoever wishes to correspond.
-
- It seems to me that the PATH variable must be pushed onto a stack by the
- executable that is created by the Quick Pascal compiler. It is then poped
- off the stack and "restored" on exit of the program. Therefore, any
- changes made to the environment variable would be nullified by the
- restoration on exit.
-
- Of course, this could all just be my imagination, and I just haven't
- discovered the proper way to do this in Pascal. But, I'm pretty thorough,
- and I've tried many different approaches to the problem, with little
- success byeond the batch file solution. The QP documentation says to use
- the /c switch with command.com, in order to execute a copy of command.com,
- passing it the command line parameters required for the desired command.
-
- For example:
-
- SwapVectors;
- Exec( 'COMMAND.COM','/c DIR *.EXE' );
- SwapVectors;
-
- The command "SwapVectors;" stores the interrupt vectors for safe keeping.
- This is in case the called program messes around with the interrupts. The
- "Exec( 'COMMAND.COM','/c DIR *.EXE' );" command would execute a copy of
- COMMAND.COM, running the DOS command "DIR *.EXE". This would obviously
- give you a list of the ".EXE" files in the present directory. The second
- "SwapVectors;" command restores the interrupt vectors to their original
- values.
-
- My theory is this:
-
- Whenever you run a copy of COMMAND.COM, you are in essence
- using a DOS within a DOS. Not exactly multitasking, but
- the basic idea is this: Any parameters you change, strictly
- concerning DOS parameters, will remain changed only so long
- as you are within the current command shell.
-
- As soon as you type "EXIT", the original states of the various
- parameters are restored.
-
- Therefore, if I'm forced to call command.com from within a
- program in order to execute an internal command, I will
- inevitably lose the effects of that command when I exit
- command.com and restore execution to my program.
-
- I'm sure you can see the problem.
-
- Again, if any of you people out there have a solution to this
- little puzzle, feel free to write me. I will appreciate it.
-