[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Calling DOS/Windows applications



> I would like to clean up the directory before I run it, and am trying something

> like this:
>
> let $comspec = 'command /c del c:\temp\mig*.*'
> call system using $comspec #status
> display #status
>
>
> I keep getting a #Status of 2, and no files have been deleted.

Try specifying the full path to the command.com program file.
You should be able to use the getenv SQR function to get that value from
the COMSPEC environment variable.  Use that value instead of the text
"command" above.  (I haven't done this in a while, but I think this will
work.  Note that you could hard-code in the full path rather than use
getenv, but then your program won't work under most Windows 3.1 or NT
installations because COMMAND.COM will be found in a different place.)

If that still doesn't work, try doing a "dir" or even an "echo" instead of
the "del" to see if you are sucessfully invoking the command interpreter.
Once you get some evidence that your dos command is working, you can work on
executing the dos command you really want to execute.

>
> I am running SQR 3 under windows 95. Also, what is the command for invoking a
> windows command line?

Hopefully, the string you send to the "call system using" command is
executed the same was a string entered into the Start | Run...  box in
Windows 95.  If this is true, you should be able to execute windows programs
using "call system using".  I haven't tried this under Windows 95, though.
(Note that the only reason you need COMMAND.COM in the "del" case is that
"del" is not an actual program, but is part of COMMAND.COM.  If you are
trying to execute actual programs then you shouldn't need COMMAND.COM, I
believe.)

Hope this helps.

                                                Nathan
----------------------------------------------------------------------------
Nathan Treadway    | Ray Ontko & Co. | info@ontko.com (auto-reply server)
nathant@ontko.com  | Richmond, IN    | ftp.ontko.com, http://www.ontko.com/