Board index » delphi » Using Dos's copy command.
Patrick D. Rockwel
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
|
Patrick D. Rockwel
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Using Dos's copy command.I've written a program which uses the following commands. mkdir('pip'); The mkdir command works fine but when I use the exec command given -Patrick- |
Patrick D. Rockwel
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Using Dos's copy command.I've written the following program. -------------------------------------------- It successfully makes the subdirectory "pip" but it DOESN'T copy -Patrick- |
Joe C. Hech
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Using Dos's copy command.Try this: {$M $4000,0,0 } {Dont take up all avalable memory!} program mtest; uses dos; var {This get command.com the full path name} Note : If you simply want to copy a file, take a look at the example for Joe |
Scott Earnes
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Using Dos's copy command.QuotePatrick D. Rockwell wrote: memory available to DOS, so it can't run an external program. Limit the heap maximum using the $M directive. Second, 'command' is a meaningless program name. The program name you exec (getenv('COMSPEC'),'/c sis.txt pip'); Third, make sure you add "swapvectors;" immediately before AND after the Also, whenever you call an external program, check the value of DosError Quote> -Patrick- Scott Earnest | We now return you to our regularly | set...@ix.netcom.com | scheduled chaos and mayhem. . . . | |
Patrick D. Rockwe
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Using Dos's copy command.In article <3372C036.4...@ix.netcom.com>, Quote>Patrick D. Rockwell wrote: program work in BP7.01, but not TP4.0. The reason that I'm so interested in this is because at one time, I was unable to get the EXEC command to work for me. Then, when I got my new computer, it DID work. But then I deleted the program which used it so, I don't remember EXACTLY why it worked for me in TP4.0. Now, for some reason it didn't work, maybe for the reasons that you gave. TP4.0 doesn't have swapvectors, or getenv. :-) |
Patri489
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Using Dos's copy command.<<<<<<<< Try this: {$M $4000,0,0 } {Dont take up all avalable memory!} program mtest; uses dos; var {This get command.com the full path name} Note : If you simply want to copy a file, take a look at the example for QuoteOne other question, I was having the problem while writing under TP 4.0. Thanks again in advance for any advice |
R.E.Dona
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Using Dos's copy command.Quotepatri48...@aol.com (Patri48975) wrote: http://users.southeast.net/~rdonais/index.html. Then instead of Quote> for i := 1 to EnvCount do CommandPath := GetEnv('COMSPEC'); Since swapvectors isn't available in TP 4.0 and you don't have {$IFNDEF VER40} SwapVectors; {$ENDIF} Naturally the above assumes that you have included DOS and UTIL in ...red |
BP
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Using Dos's copy command.Patrick D. Rockwell <prockw...@thegrid.net> wrote in article Quote> I've written the following program. help of exec -- |
Mike Copelan
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Using Dos's copy command.Quote> > I've written the following program. isn't needed - or of any value - here?) 8<}} |
Patrick D. Rockwel
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Using Dos's copy command.QuoteMike Copeland wrote: program in my post. Oh well, I've solved my problem with the exec procedure. Thanks! -Patrick- |
Osmo Ronkan
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Using Dos's copy command.In article <19970509070301.DAA08...@ladder01.news.aol.com>, QuotePatri48975 <patri48...@aol.com> wrote: SCOMSPEC=foo ? When you are going to reinvent the wheel, make sure that it is round. Osmo |
Osmo Ronkan
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Using Dos's copy command.In article <3372C036.4...@ix.netcom.com>, Quote
buggy that it is not worth executing. (I am not talking about TSR's which should not be executed under exec() anyway) Osmo |
Mike Copelan
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Using Dos's copy command.Quote> >I've written a program which uses the following commands. in the directory from where the program is being executed. And you shouldn't hard-code any path/file name into a program which has the potential of being executed on other systems (where key files and paths could well be different). A far better way to handle the situation is to do the following: Exec (GetEnv('COMSPEC'),'/C copy [source file] [destination file]') This uses the GetEnv function to obtain the system variable COMSPEC |
Frank Wo
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Using Dos's copy command.On Tue, 06 May 1997 17:47:01 -0700, "Patrick D. Rockwell" Quote<prockw...@thegrid.net> wrote: exec('\command.com','/c copy [source file] [destination file] You should specify the paths to these files. Frank Wood |
Richard Adam
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Using Dos's copy command.In article <33823d5c.8002...@news.dircon.co.uk>, Frank Wood <woodf- Quote>On Tue, 06 May 1997 17:47:01 -0700, "Patrick D. Rockwell" pascal help. -- Richard Adams Turnpike evaluation. For information, see http://www.turnpike.com/ |
1. Using DOS 'move' command through TP7
2. HELP!!! WINEXEC and DOS COPY command - DELPHI 1.0
5. Sort Record after using 'union' command
6. Using the Exec command to run Dos functions.
7. Using Dos Commands Through Pascal
8. DOS PROGRAM COMMAND LINE INPUT USING DELPHI
9. Newbie help: executing MS-DOS commands using Delphi
10. Compile program for MS-DOS using Borland Free Command-Line Tools