Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!mit-eddie!rutgers!mcdchg!ddsw1!andyross From: andyross@ddsw1.MCS.COM (Andrew Rossmann) Newsgroups: comp.lang.pascal Subject: Re: Pascal Question Message-ID: <1989Dec2.021527.22175@ddsw1.MCS.COM> Date: 2 Dec 89 02:15:27 GMT References: <89334.082120JTW106@PSUVM.BITNET> <1989Dec1.134808.4158@uwasa.fi> Reply-To: andyross@ddsw1.MCS.COM (Andrew Rossmann) Organization: ddsw1.MCS.COM Contributor, Mundelein, IL Lines: 27 >>While using TP 5.0's EXEC command, the program seems to 'skip' over the EXEC >>statement. I am using the $M compiler directive, but it still won't work. >>program testEXEC; >>{$M $4000,0,0} >> uses DOS; >>begin >> exec ('Command.com',''); >>end. > You should put a SwapVectors before and after every Exec call. begin SwapVectors; Exec(GetEnv('COMSPEC'), ''); SwapVectors; end. The SwapVectors restores several interrupts that Turbo Pascal grabs. If they still point to TP, you could have problems. You ideally should also use the COMSPEC environment variable when call COMMAND.COM, since it may not be in a normal place. It could (as in my case) be 4DOS.COM instead! Andrew Rossmann andyross@ddsw1.MCS.COM