home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / msdos / programm / 12523 < prev    next >
Encoding:
Text File  |  1993-01-28  |  3.0 KB  |  69 lines

  1. Newsgroups: comp.os.msdos.programmer
  2. 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
  3. From: douglas@cs.scarolina.edu (G. David Douglas Jr.)
  4. Subject: Re: Help - DOS commands from program...
  5. Message-ID: <douglas.728101903@ebony.cs.scarolina.edu>
  6. Sender: usenet@usceast.cs.scarolina.edu (USENET News System)
  7. Organization: USC  Department of Computer Science
  8. References: <1k4gi7INNou2@charnel.ecst.csuchico.edu>
  9. Date: 27 Jan 93 02:31:43 GMT
  10. Lines: 57
  11.  
  12. jmeyers@ecst.csuchico.edu (Jeff Meyers) writes:
  13.  
  14. >I have written a simple installation program in Turbo Pascal and am having
  15. >trouble executing DOS commands from within this program.
  16.  
  17. >If the user types "a:install" everything works fine.  But, if they log to
  18. >the floppy first, then run install ( A:\>install <cr> ) things choke.
  19.  
  20. >Specifically, the destination directory is not created and so the files
  21. >are all copied into a file in the root directory.  I use the Turbo Pascal
  22. >command exec() to call the following command:
  23.  
  24. >    \command.com /C md C:\DEST
  25.  
  26. >I also had trouble logging drives and changing directories under program
  27. >control, but got around that by haveing the install program create the
  28. >appropriate batch file, then executing it...
  29.  
  30. >Question: am I missing something? Why don't the DOS commands work the
  31. >same as at the command line??
  32.  
  33. >-- 
  34. >============================================================================
  35. >| Jeff Meyers      |  jmeyers@ecst.csuchico.edu      | 39x43'N  121x48'W   |
  36. >| Chico, Ca 95926  |  KD6DIS@KE6LW.#NOCAL.CA.USA.NA  | Grid: CN80-CM99 ??  |
  37. >============================================================================
  38.  
  39. Well, ideally I'd like to have more information, but here's a hunch:
  40.  
  41. Does the floppy disk you're trying to run the utility from have a
  42. copy of COMMAND.COM on it?  If not, and if you're trying to execute
  43. \COMMAND.COM instead of C:\COMMAND.COM, for instance, it probably won't
  44. work -- can't find COMMAND on the floppy disk, so can't execute it.
  45.  
  46. Also, I don't know which version of Turbo Pascal you're using, but:  does a
  47. command like getenv (or get environment entry) exist in your version?  If so,
  48. you could retrieve the (it _should_ be there) string associated with the
  49. COMSPEC environment variable, and use THAT for the drive-name/directory-path
  50. to a copy of COMMAND.COM to execute.
  51.  
  52.  
  53. Just my opinion on what MIGHT be wrong.
  54.  
  55. One last note:  I once wrote a utility (under Turbo Pascal 3.1 (old, I
  56. know :-)) that does some of the operations (change drive, change
  57. directory, etc.) you describe; problem is, nothing like the  exec  command
  58. was around (had to write my own code to do that).  If I remember correctly,
  59. version 3.1 had a command called  chdir  (change directory) -- does yours?
  60. (Change drive was something else -- I ended up using the DOS-services
  61. (MSDOS ?) function to change disk drive, change file attributes, etc.)
  62. Drop me a line if you'd like a copy of the source code (now just collecting
  63. dust on my disk drive :-).
  64.  
  65.  
  66. David Douglas
  67. douglas@usceast.cs.scarolina.edu
  68.  
  69.