home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.msdos.programmer
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!bogus.sura.net!opusc!usceast!douglas
- From: douglas@cs.scarolina.edu (G. David Douglas Jr.)
- Subject: Re: Help - DOS commands from program...
- Message-ID: <douglas.728101903@ebony.cs.scarolina.edu>
- Sender: usenet@usceast.cs.scarolina.edu (USENET News System)
- Organization: USC Department of Computer Science
- References: <1k4gi7INNou2@charnel.ecst.csuchico.edu>
- Date: 27 Jan 93 02:31:43 GMT
- Lines: 57
-
- jmeyers@ecst.csuchico.edu (Jeff Meyers) writes:
-
- >I have written a simple installation program in Turbo Pascal and am having
- >trouble executing DOS commands from within this program.
-
- >If the user types "a:install" everything works fine. But, if they log to
- >the floppy first, then run install ( A:\>install <cr> ) things choke.
-
- >Specifically, the destination directory is not created and so the files
- >are all copied into a file in the root directory. I use the Turbo Pascal
- >command exec() to call the following command:
-
- > \command.com /C md C:\DEST
-
- >I also had trouble logging drives and changing directories under program
- >control, but got around that by haveing the install program create the
- >appropriate batch file, then executing it...
-
- >Question: am I missing something? Why don't the DOS commands work the
- >same as at the command line??
-
- >--
- >============================================================================
- >| Jeff Meyers | jmeyers@ecst.csuchico.edu | 39x43'N 121x48'W |
- >| Chico, Ca 95926 | KD6DIS@KE6LW.#NOCAL.CA.USA.NA | Grid: CN80-CM99 ?? |
- >============================================================================
-
- Well, ideally I'd like to have more information, but here's a hunch:
-
- Does the floppy disk you're trying to run the utility from have a
- copy of COMMAND.COM on it? If not, and if you're trying to execute
- \COMMAND.COM instead of C:\COMMAND.COM, for instance, it probably won't
- work -- can't find COMMAND on the floppy disk, so can't execute it.
-
- Also, I don't know which version of Turbo Pascal you're using, but: does a
- command like getenv (or get environment entry) exist in your version? If so,
- you could retrieve the (it _should_ be there) string associated with the
- COMSPEC environment variable, and use THAT for the drive-name/directory-path
- to a copy of COMMAND.COM to execute.
-
-
- Just my opinion on what MIGHT be wrong.
-
- One last note: I once wrote a utility (under Turbo Pascal 3.1 (old, I
- know :-)) that does some of the operations (change drive, change
- directory, etc.) you describe; problem is, nothing like the exec command
- was around (had to write my own code to do that). If I remember correctly,
- version 3.1 had a command called chdir (change directory) -- does yours?
- (Change drive was something else -- I ended up using the DOS-services
- (MSDOS ?) function to change disk drive, change file attributes, etc.)
- Drop me a line if you'd like a copy of the source code (now just collecting
- dust on my disk drive :-).
-
-
- David Douglas
- douglas@usceast.cs.scarolina.edu
-
-